Documentation on "Container"


#1
Uncaught Error: Assertion Failed: `<(subclass of Ember.ObjectController):ember947> specifies `needs`, but does not have a container. Please ensure this controller was instantiated with a container.

After encountering the error above and reading the documentation, it is unclear what a container is. If you search for “container” in the API docs gives http://emberjs.com/api/classes/Ember.ContainerDebugAdapter.html#stq=container&stp=1

The container is not really part of the public API it seems, but there are still places where it pops up in user facing portions like above. I don’t know what the solution for that is but just an observation. As a user for instance, I don’t have clear way of figuring out what to do based on the error message and documentation alone.

BTW it would seem the case is being encountered because I have controller that is being declared inside a ListItemView’s init method, which seems to be the only way to get to get independent controllers for the ListItems in CollectionView: https://github.com/emberjs/ember.js/issues/4137 so for what is probably a pretty common use-case – of wanting to have a list of items each with individual functionalities complex enough to warrant its own controller, there seems to be a lot of resistance from EmberCollectionView. </gripe>


#2

The right way to do it is to specify an itemcontroller, take a look at http://emberjs.com/api/classes/Ember.ArrayController.html which discusses how to use one.


#3

opsb, thanks for your suggestion but I suppose you missed the fact that that is already being done. See: “CollectionView does not work with itemController”.