Integrating iCanHaz and Marionette

前提是你 提交于 2019-11-29 12:58:24

Okay, I couldn't find an easy way to do this using ICH. However, due to another SO I found, very similar functionality can be found just using Mustache.

Using this code:

 Backbone.Marionette.TemplateCache.prototype.compileTemplate = function(rawTemplate) {
    return Mustache.compile(rawTemplate);
 }

Lets you change the renderer so you can pull mustache templates from index.html using Marionette's template call. A mustache template looks like this:

 <script id="headerTemplate" type="text/template">
        <p>{{user_name}}</p>
        <p>{{tenant}}</p>
    </script>

The difference is that the type is 'text/template' as opposed to 'text/html'. Otherwise it acts very similar.

Hope this helps someone else.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!