【发布时间】:2013-09-06 07:38:30
【问题描述】:
我的 ember 应用程序中有 #each 循环并且想知道循环的索引,所以我尝试像这样使用 {{@index}}:
<script type="text/x-handlebars" data-template-name="column">
<ul>
{{#each item in controller}}
{{@index}}
{{item-rows currentItem=item}}
{{/each}}
</ul>
</script>
但在 chrome 中,我收到此错误:
Uncaught SyntaxError: Unexpected token , handlebars.js:1457
我的 ember.js 版本是 rc8,handlebars 是 1。我需要一个解决方案来找到 #each 的索引。
【问题讨论】:
标签: javascript ember.js handlebars.js