使用Ember Handlebars迭代时,获取数组索引的正确方法是什么?

Jai*_*ime 12 indexing handlebars.js ember.js

{#each controller.content.assetAllocation.class}}
    {{@index}}
{{/each}}
Run Code Online (Sandbox Code Playgroud)

我正在尝试运行上面的代码,它应该输出数组的索引,但它会产生一个错误:"Uncaught SyntaxError:Unexpected token"

Jai*_*ime 16

解决方案并不像我希望的那样好,但这有效:

{#each controller.content.assetAllocation.class}}
    {{_view.contentIndex}}
{{/each}}
Run Code Online (Sandbox Code Playgroud)