在我的ember应用程序中,我有一个对象数组.我需要操纵数组中的一些对象.
例如:数组:[{a:1}]
然后我需要将a更改为2.
someArray: [{a: 1}],
didInsertElement() {
var self = this;
this.$('.some-element').on('scroll',function() {
self.get('someArray')[0]['a'] = 2; // HOW TO DO THIS ?
});
}
Run Code Online (Sandbox Code Playgroud)
此外,我还需要将更改反映在视图中.
注意:Ember版本1.13
Pra*_*ash 16
var temp = self.get('someArray').objectAt(0);
Ember.set(temp, "a", 2);
Run Code Online (Sandbox Code Playgroud)
这应该工作
归档时间: |
|
查看次数: |
5607 次 |
最近记录: |