calling function with arguments in mustache javascript

后端 未结 4 1523

Is it possible to call a function with arguments with Mustache.js

{{somefunction(somevalue)}}
thank you

4条回答
  •  情话喂你
    2020-12-05 17:36

    If you want the script contents to be executed after the markup is inserted nito the dom you should use some library that will do the same like jquery.

    Try this out here:

    http://jsfiddle.net/anilkamath87/GBP8N/

    Also if you want to invoke some other method in your script file. All you need to do is call the function depending on the scope of that function and if it has been preloaded into the dom.

    Hope this helps.

    P.S: note the escape of the script tag in the template markup

提交回复
热议问题