4
我有一個JSON字符串:如何使用ICanHaz for mustache javascript模板引擎?
{
"items": [
{"name": "red" },
{"name": "blue" }
],
"test" : {
"items" :[
{ "name" : "Hello" },
{ "name" : "World" }
]
}
}
如何打印出
<li>Hello</li>
<li>World</li>
我與下面的模板嘗試,但它不工作。它會打印「紅色和藍色」。我無權訪問更改JSON字符串,我只能操作模板。
{{#test}}
{{#items}}
<li>{{name}}</li>
{{/items}}
{{/test}}