Can view functions be used in Mustache?

Can view functions, like portal.assetUrl, be used in mustache templates?

Hi,

That should be possible by just using the Mustache format for adding data from the Controller.
I haven’t used Mustache but it might be as easy as using {{portal:assetUrl(whatnot)}} in your code.

This is the setup for the controller:
http://xp.readthedocs.org/en/5.3/reference/script-commands/view/mustache.html

I’ve invited a few other developers here that might know more.

Hi Helge!

There’s currently no portal functions in Mustache. You need to create the urls in your controller and pass them to Mustache. The documentation for 6.0 will be clearer on this.

Regards,
Morten

1 Like

Reason for this is that Mustache is “logic less” - so everything must be passed in with the model. We’re investigating if we can get around this somehow for the portal functions - @srs knows more on this.