Dynamic 如何在Ember视图的每条语句中动态生成css类

Dynamic 如何在Ember视图的每条语句中动态生成css类,dynamic,ember.js,each,Dynamic,Ember.js,Each,获取错误原因:断言失败:Ember.CollectionView的内容必须实现Ember.Array 我使用自定义视图将动态命名的类应用于每个帮助程序中的项目。类名是由属性在视图内部生成的,而不是由提供的索引生成的 App.circleController = Ember.ArrayController.extend({ setupController: function(controller) { controller.set('content', [1,2,3,4,5

获取错误原因:断言失败:Ember.CollectionView的内容必须实现Ember.Array

我使用自定义视图将动态命名的类应用于
每个
帮助程序中的项目。类名是由属性在视图内部生成的,而不是由提供的索引生成的

App.circleController = Ember.ArrayController.extend({
    setupController: function(controller) {
        controller.set('content', [1,2,3,4,5,6,7]);
    }
});
在模板中,我通过每个迭代中的
{{view}
助手提供索引

App.ItemView = Ember.View.extend({
    classNameBindings: ['itemClass'],
    index: null,

    itemClass: function() {
        return 'class-'+this.get('index');
    }.property('index')
});

仔细看看,.

是否需要类绑定?或者只是生成类名?我确信有必要使用第n个子CSS选择器将正确的类放在正确的元素上。如果你给我一点你想要的最终项目应该是什么样的信息,我会给你指出正确的方向。
App.ItemView = Ember.View.extend({
    classNameBindings: ['itemClass'],
    index: null,

    itemClass: function() {
        return 'class-'+this.get('index');
    }.property('index')
});
{{#each value in controller}}
    {{#view App.ItemView indexBinding="value"}}
        Item #{{value}}
    {{/view}}
{{/each}}