我正在使用车把自己的示例来使这个工作,但显然属性不会模板
var source = "<p>Hello, my name is {{name}}. I am from {{hometown}}. I have " +
"{{kids.length}} kids:</p>" +
"<ul>{{#kids}}<li>{{name}} is {{age}}</li>{{/kids}}</ul>";
var template = Handlebars.compile(source);
var data = { "name": "Alan", "hometown": "Somewhere, TX",
"kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
var result = template(data);
结果变量是:
<p>Hello, my name is . I am from . I have kids:</p><ul></ul>
我错过了什么?
答案 0 :(得分:0)
我忘了提到我在Node中使用快速把手作为视图引擎,我认为它不相关。但解决方案是在所有客户端{{