我正在使用backbone.js和underscore.js构建一个JavaScript应用程序。由于阅读和尝试在模板中嵌套另一个模板,就像下面这样的操作几个小时了,变得越来越令人沮丧。
我的模板使用内置的underscore.js模板引擎:
<script id="navigation_template" type="text/template">
<div><%= title %>
<% _.each(children, function(child) { %>
<% render_this_template_recursively(child) %>
<% }); %>
</div>
</script>
我想要为每个子元素渲染这个模板( render_this_template_recursively(child) )。我该如何实现?
谢谢。