In my ember application, I have an array of objects. I need to manipulate some object inside the array.
eg: Array: [{a:1}]
then I need to change a to 2.
someArray: [{a: 1}],
didInsertElement() {
var self = this;
this.$('.some-element').on('scroll',function() {
self.get('someArray')[0]['a'] = 2; // HOW TO DO THIS ?
});
}
Also, I need the changes to be reflected in the view as well.
Note: Ember version 1.13
var temp = self.get('someArray').objectAt(0);
Ember.set(temp, "a", 2);
This should work
Ember.set(this.get('array').objectAt(index),'prop',value)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With