1
votes

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:

  • the 'needs' property is set up correctly on the item controller
  • the .property() on the item controller is pointing to the correct field on the array controller
  • Answers to similar questions on SO have not adequately resolved my issue
1

1 Answers

1
votes

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/