我试图在模板中使用Ember.Select。Ember.Select在没有任何属性的情况下工作。但是,当我指定属性内容时,它给我的错误是
Uncaught Error: assertion failed: an Ember.CollectionView's content must implement Ember.Array. You passed countries我的徽章模板如下,
Ember.Select // Works fine
Ember.Select content=countries //Gives the listed errorApp.IndexController中的代码是,
countries : function () {
return ["India","US","England"]; // I have also tried passing the value in Ember.A(array_val)
}.property('')发布于 2015-07-07 10:59:36
我对Emblem并不熟悉,但首先,可能值得尝试按照API文档创建一个select,并将countries定义为一个文字数组。
countries : ["India","US","England"],但是,我认为您的问题是将其定义为一个名为nothing的.property('')。如果您不想重命名您的属性,只需将其设置为:.property(),或者如果您想称它为不同的.property('countriesCollection')。这将允许您在模板中使用countriesCollection。
您还应该了解一下计算性质,因为您可能想对数组做些什么(否则,它也可能是一个文字数组)。
另外,Ember 1.13有已弃用视图,因此您应该实际使用组件驱动的方法,而不是使用视图和控制器。有一个很好的select组件名为X-选择,它与Ember.Select视图API兼容。
https://stackoverflow.com/questions/31265626
复制相似问题