【发布时间】:2015-01-05 10:03:04
【问题描述】:
我不太了解 Mustache / Hogan.js 的部分/模板继承。正如here 和here 所定义的那样,您似乎必须有两个不同的文件才能使其工作。我在我的(客户端)页面中使用它如下:
<template id="server-template">
{{#servers}}
<b>some html and {{> some other which I dont understand how to use}}</b>
{{/servers}}
</template>
<template id="room-template">
I want this in up there. (in the "partials" tag)
</template>
感谢您的帮助。我用这个编译它们:
var source = $('#room-template').html(),
compiled = Hogan.compile(source)
$('#main').html(compiled.render(data))
这可能吗?
【问题讨论】:
标签: javascript mustache hogan.js