2014-03-28 47 views
1

我有一個對象,我已經在使用把手{{#each}}來顯示模板中的內容 - 但是,在每個對象中都有一個我也需要的數組循環。迭代在Ember車把中的陣列每個

需要實現類似的東西。

{{#each item}} 

    {{title}} 
    {{rating}} 

    {{#each array_field}} 
    {{field}} 
    {{anotherField}} 
    {{/each}} 

{{/each}} 

回答

3

您可以創建一個指向VAR當前項,然後查詢您的數組屬性:

{{#each item in controller}} 
    {{item.title}} 
    {{item.rating}} 

    {{#each otherItem in item.arrayField}} 
    {{otherItem.field}} 
    {{/each}} 

{{/each}}