Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4826

setUnknownProperty

$
0
0

@ofridagan wrote:

I'm trying to run some code whenever a new property is set on an object.
I tried:

var MyObject = Ember.Object.extend({
  setUnknownProperty: function(k,v){
    runMyCode()
    return;
  }
});

I relayed on this doc for Object.set:

If setUnknownProperty() returns undefined, then set() will simply set the value on the object

But it didn't!
If I remove setUnknownProperty method, the property is set, but with it it just doesn't.
I also tried:

  setUnknownProperty: function(k,v){
    this[k] = v;
    this.notifyPropertyChange(k);
    return v;
  }

But with no luck.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4826

Trending Articles