1

I have a user address form with the standard inputs (name, address, zip, etc). When the user returns to their address I need to watch for changes and disable other options.

I tried:

updateAddress: function() {
  console.log('updated')
}.observes(App.Address)

App.Address is an Ember.Object I end up creating that stores all the user address data. The only time this logged out data was when I loaded the page and when I resubmitted the data. But I need it to check it instantly.

Is it possible for me to watch the entire object without doing a good amount of extra work like discussed here: Ember.js: Observing all object properties ?

EDIT: Added a JSBin: http://emberjs.jsbin.com/zadef/3/edit?html,js,console,output

Community
  • 1
  • 1
JDillon522
  • 19,046
  • 15
  • 47
  • 81
  • `.observes(..)` should probably take an instance, not a class. Might need a JSBin for additional help... – claptimes May 06 '14 at 17:21
  • @claptimes added a JSBin – JDillon522 May 06 '14 at 18:19
  • We have something similar in our app, except it's following a plain property on the `App` instance; have you tried `.property('App.Address')`? I'm pretty sure you need to pass a string to [`observes`](http://emberjs.com/guides/object-model/observers/) as well. – Patrick M May 06 '14 at 18:45
  • @PatrickM yeah I've tried both `.property(App.Address)` and `.property('App.Address')` as using `.observes()` with a string passed as the argument. – JDillon522 May 06 '14 at 18:59
  • Then I think you're out of luck. Just observing an object like that is probably only going to catch changes to the whole reference. If you update a property on the object, the reference is unchanged, and your observer is unchanged. – Patrick M May 06 '14 at 19:19

0 Answers0