Documentation on "Container"

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

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: 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>

The right way to do it is to specify an itemcontroller, take a look at Ember - 4.6 - Ember API Documentation which discusses how to use one.

1 Like

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”.