admin管理员组文章数量:1323723
I am trying to include a partial inside my template from within a directory.
This works:
{{>header}}
This doesn't:
{{>inc/header}}
{{>../header}}
Any location other than a sibling doesn't seem to be picked up. Is this normal?
I am trying to include a partial inside my template from within a directory.
This works:
{{>header}}
This doesn't:
{{>inc/header}}
{{>../header}}
Any location other than a sibling doesn't seem to be picked up. Is this normal?
Share Improve this question edited Apr 19, 2016 at 11:46 Alex 8,3137 gold badges54 silver badges80 bronze badges asked Dec 9, 2011 at 14:05 wilsonpagewilsonpage 17.6k23 gold badges105 silver badges150 bronze badges1 Answer
Reset to default 6header
, inc/header
, and ../header
are just names of keys in the partials object passed in at rendering time that have values of the partial text
var tmpl = "{{>header}} {{>inc/header}} {{>../header}}",
data = {},
partials = {
header : "<header>example</header>",
'inc/header' : "<header>xmpl</header>",
'../header' : "whatever"
},
html = Mustache.render(tmpl, data, partials);
document.write(html);
See here on jsFiddle http://jsfiddle/maxbeatty/CWKHe/
本文标签: javascriptPartial include paths in mustachejsStack Overflow
版权声明:本文标题:javascript - Partial include paths in mustache.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742123516a2421832.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论