wanovak
wanovak

Reputation: 6127

Ember: How to determine which property changed in a multi-property observer

With something like the following how can I determine which of the three properties has changed without resorting to something tedious like printing out all the values each time, or creating three separate observers?

variableObserver: Ember.observer('variable.{name,value,type}', function() {

  // which property changed?

}),

Upvotes: 0

Views: 151

Answers (1)

Vignesh Raja
Vignesh Raja

Reputation: 8751

You can do using arguments array.

variableObserver : Ember.observer('variable.{name,value,type}',function(){
        this.set("changedvalue",arguments[1]);
}),

Added an example Ember Twiddle

Upvotes: 1

Related Questions