onArrayChanged: function(obj, keyName, value) {
// What is value here, exactly?
}.property('array.@each')
When an element is added to the array, how do I know which value was added? LIkewise, when a value is removed from the array, how do I access that?
Have a look at addArrayObserver , see http://jsfiddle.net/pangratz666/EE65Z/ :
var a = Ember.A('a b c d e f g'.w());
var o = Ember.Object.create({
arrayWillChange: Ember.K,
arrayDidChange: function(array, start, removeCount, addCount) {
console.log(arguments);
}
});
a.addArrayObserver(o);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.