Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
`ArrayController` always returns the same instance when using `itemController` #2009
I'm not sure of the best way to resolve this issue directly though we have
On Feb 9, 2013, at 1:31 AM, Andrey Ivashchenko email@example.com
We should warn about this conflict somehow. Once I had spent about 30
I think it makes sense to use the same controller as your "show" route. So either this should be filed as bug or
For example, I can clearly see the case where I want to store some application state in a particular
My case scenario is the following:
I want to reuse the same instance of the controller on the list or in its "show" route, because I want to store some application state in each one.
After giving it some thought, it seems like the issues start here, at
If I do understand it well, it will create a different instance of itemController for each item and cache it in the
The visibility of this
So here is a possible work around http://jsfiddle.net/sSdHm/66/
I definitely agree the behavior is surprising, especially the fact that it works on the first list render.
This is the explanation, what is the right thing to do, I am not sure. I get the case of reuse of controller in the show route. Seems like a valid idea. Seems like the solution would be to pass in to the route the caller controller container. It could work, but I am not sure about all the semantics.
Thanks for shining some light on it, @tchak. I actually ended up doing something like your fix, but inheriting a whole controller instead. Your workaround looks nicer though.
Yet as you point out this doesn't solve the case when you want to store something in the controller.
I think this is kind of an important issue to solve, specially since the Ember team seems to be encouraging using controllers to store application state:
It would be awesome to do something like storing the controller's variables in a Client-Side HTML5 storage in a seamless way, for example.
referenced this issue
Feb 12, 2013
There is one doubt left. The