【发布时间】:2012-03-12 22:00:26
【问题描述】:
我有一个简单的对象层次结构,包括:
Category
String name
List childCategories;
我想以通用方式使用把手来表示此布局,但我无法理解如何嵌套布局。鉴于此布局:
<script id="categories-template" type="text/x-handlebars-template">
{{#categories}}
<ul >
<li>
<span>{{name}}</span>
<div>{{#childCategories}}{{/childCategories}}</div>
</li>
</ul>
{{/categories}}
</script>
为所有子类别重用现有类别模板的最佳方法是什么?是否需要注册处理程序?有没有更简单的方法?
【问题讨论】:
标签: javascript json templates