# Listen for property changes in a object

**URL:** <https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011>\
**Category:** Uncategorized\
**Created:** [August 1, 2014, 5:58pm UTC](https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011 "2014-08-01T17:58:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarasa](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@sarasa](https://discuss.emberjs.com/u/sarasa)\
**Post date:** [August 1, 2014, 5:58pm UTC](https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011/1 "2014-08-01T17:58:41Z")

</div>

I know that currently it is possible to add an observer for a property or properties by name. But i need to listen for changes in any property for a given object, without knowing their names.

The use case: in a future, Ember will support query parameters from the URL; in the meantime as a simple workaround, im would like to use a shared `Ember.Object` between the router and the controller to contain query options. Whenever the controller changes a property in this object (say, by user input), the router would react to this change and reload itself.

Im looking for something like overriding the `set` function for an individual object (which didnt work), or an event listener maybe? (ive seen that observers use `addListener`).

---

<div class="post-metadata">

**Author:** ![hilo](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/hilo/32/10609_2.png) [@hilo](https://discuss.emberjs.com/u/hilo)\
**Post date:** [August 8, 2014, 7:50am UTC](https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011/2 "2014-08-08T07:50:26Z")

</div>

Why not capture the query parameters and use them to create an Ember.Object that you pass to controllers as a property of the controller?

Perhaps I’m not understanding your question, but it seems to me that that should work. I’ve done something similar, even though it’s arguably an ill-advised approach.

---

<div class="post-metadata">

**Author:** ![sarasa](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@sarasa](https://discuss.emberjs.com/u/sarasa)\
**Post date:** [August 11, 2014, 2:03pm UTC](https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011/3 "2014-08-11T14:03:16Z")

</div>

Thanks for your answer. Passing an Ember.Object is how i finally solved it. The properties of this object are binded to a few form controls, which when changed by the user, should reload the model.

Right now, in Ember docs i cant find anything about how to listen for changes in any/every property of that object. Instead i need to write an explicit list of properties, and add a property observer for each one.

Ive written my use case because i was initially going to ask if it was possible to add this as a built-in Ember feature; but after thinking about it, i could not find another real usage.

---

<div class="post-metadata">

**Author:** ![mxrguspxrt](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@mxrguspxrt](https://discuss.emberjs.com/u/mxrguspxrt)\
**Post date:** [September 24, 2014, 7:59am UTC](https://discuss.emberjs.com/t/listen-for-property-changes-in-a-object/6011/4 "2014-09-24T07:59:39Z")

</div>

It can be done with Observers.

Example can be found:

[https://github.com/emberjs/ember.js/blob/v1.7.0/packages/ember-handlebars/lib/controls/select.js#L57-L66](https://github.com/emberjs/ember.js/blob/v1.7.0/packages/ember-handlebars/lib/controls/select.js#L57-L66)
