Scot
Scot

Reputation: 582

Ember - computed property not firing/updating

I have an array controller where I want a value that will indicate which item in the array has been selected in the UI. I've modelled what I'm doing after this post:

https://teamgaslight.com/blog/intermediate-ember-controller-concepts

Seems pretty simple, but in my app, I am using the {{render}} helper. The render helper is due to having multiple lists similar to this one

The problem is that when I click on the list item, the appropriate actions fires and updates the correct field on the array controller, but the item controllers' computed property is not updating/firing.

here is a JSBin that illustrates my issue (note that you'll need to click on the 'states' item to reveal the list of states):

http://jsbin.com/fucaqe/1/

I used the render helper because in the actual app, there are three lists similar to this in the same area and breaking each list seemed to be the best way to organize the code and keep my sanity :-)

Things I've verified:

Upvotes: 1

Views: 1208

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

You can't use needs on a controller that isn't a singleton, and controllers that aren't singletons won't make sense (such as item controller items).

Additionally computed properties aren't computed unless something tries to get them.

Example: http://jsbin.com/zevuzo/1/edit

http://emberjs.com/guides/controllers/dependencies-between-controllers/

Upvotes: 1

Related Questions