Observer similar to @each but on object instead of array

Hi,

I need to set an observer for tracking changes in object keys. Let’s say, like below:

App.Something = Ember.Object.extend({
  updatePropTest: function(){
    console.log(333, "XXX"); // XXX
  }.observes("info.@each"),
});
...
obj = App.Something.create();
obj.set("info.name");

But as you know, @each doesn’t cover it.

Any idea?

Here is how I’ve done it in the past Ember Latest - JSFiddle - Code Playground

1 Like

Hi, thanks. I’ve done something similar too but I thought there was a “right” way under Ember’s specs.

Yea, there is a few ways to do it. Though, I don’t think there is any “official” ember-way.

Perhaps setUnknownProperty is what you need?

There is also a parallel unknownProperty function which is fired when you try to get a property that does not exist

Hummm, that really looks to be what I’m searching for :slight_smile: I will know it a bit more, thank you @alexspeller