Is it possible to observe changes on a single array element in Ember?
[]
and @each
properties can be used to observe changes on all array elements, but what if I am only interested in one element and don't want updates for the rest? Especially if the rest of the array is large and changing often.
I would have hoped that observing things.[0].name
would work, am I missing something?
atEachNameChanged: Ember.observer('things.@each.name', function() {
this.get('messages').pushObject('@each triggered');
}),
atIndexedNameChanged: Ember.observer('things.[0].name', function() {
this.get('messages').pushObject('[0] triggered');
}),
bracketNameChanged: Ember.observer('things.[].name', function() {
this.get('messages').pushObject('[] triggered');
}),
Aucun commentaire:
Enregistrer un commentaire