Emberjs is a model that has changed in @each

I have ArrayControllerone that oversees changes in the specific properties of each model. For this purpose I use .observes('content.@each.someprop'):

App.ListController = Em.ArrayController.extend({
    content: [],

    myObserver: function () {
        //check changed property
        //do stuff if changed to some specific value
    }.observes('content.@each.someprop')
});

It is still so good - the observer is triggered when the property of any model changes. However, when it fires, I don’t know which model has changed - I need to iterate over the models and compare this property with the old values ​​stored elsewhere in order to understand this, which is very awkward and inefficient. I tried to check argumentswhich the observer receives, but they are also useless: console.log(arguments)from within the observer gives the following: [Class, "content.@each.someprop"]and console.log(arguments[0].toString())gives <App.ListController:ember366>- the controller itself and the string property.

, : , @each?

Update

, , - , , -.

, itemController .

+5
2
+1

, this. @each, , , - .

itemController , .

0

All Articles