title: "Please ensure this controller was instantiated with a container"
body: <pre><code>Uncaught Error: Assertion Failed: `&lt;(subclass of Ember.ObjectController):ember947&gt; specifies `needs`, but does not have a container. Please ensure this controller was instantiated with a container.
  </code></pre>
  
  <p>If for some reason a controller doesn't have a container, how can I provide it with one? Context is below, but that is essentially the question being asked.</p>
  
  <p>The context is that there apparently is not a straightforward way of providing controllers for the individual items in Ember.CollectionView, a problem which is outlined at <a href="https://github.com/emberjs/ember.js/issues/4137" rel="nofollow">ember.js/issues/4137</a>.</p>
  
  <p>It seems the only way to get item controllers is to declare the them inline in the init method for an inline itemViewClass declaration of the CollectionView (as confirmed by the originator of that ticket):</p>
  
  <pre><code>var someCollectionView = Ember.CollectionView.extend({
    itemViewClass: Ember.ListItemView.extend({
                       templateName: "foo-item",
  
                       init: function(){
                         var content = this.get('content');
                         var controller = Ember.ObjectController.extend({
  
                                              // controller for individual items in the collection
  
                                              actions: {
                                                  // actions specific to those items
                                                  }
                                              }
                          }).create({
                              content: content,
                          });
                          this.set('controller', controller);
                          this._super();
                       }
                    })
  });
  </code></pre>
  
  <p>So this works, however if you add a "needs" property to this controller, it gives the error about no container. These item controllers will be observing a property on an external controller, so I need the "needs". So how do I instantiate the controller with the container... or hack it in after instantiation?</p>