title: Ember.js - how do I bind a controller in a nested collection?
body: <p>I'm learning ember.js, I haven't built anything with it yet.</p>
  
  <p>I'm storing my data in model objects and using controllers to act as a glue between the view and the models. A controller has content set to an instance of the model, and the view has a binding to the content in controller (and hence to the model by proxy). Like so:</p>
  
  <pre><code>// js
  App.MyModel = Ember.Object.extend({foo:''});
  App.myController = Ember.Object.create({
      content: App.MyModel.create()
  });
  
  // html
  {{view Ember.TextInput valueBinding="App.myController"}}
  </code></pre>
  
  <p>So far so good. But I don't know how to apply this paradigm to nested collections:</p>
  
  <pre><code>//js
  App.ChildController = Ember.ArrayController.extend();
  App.NestedModel = Ember.Object.extend({
      init: function() {
          this._super();
          this.set('children', []);
          // Here: I can't give a global name for the content binding, and I don't know how to give a relative one
          this.set('childController', App.ChildController.create({contentBinding: 'children');
      }
  });
  App.myController = Ember.ArrayController.create({
      content:[],
      newChild: function() {
          this.pushObject(App.NestedModel.create());
      }
  });
  
  
  // html
  {{#collection contentBinding="App.myController"}}
      {{#collection contentBinding="content.childController"}} &lt;!-- nope --&gt;
          {{content.childField}}
      {{/collection}}
  {{/collection}}
  </code></pre>
  
  <p>Here's something you can fiddle with: <a href="http://jsfiddle.net/DwheG/" rel="nofollow">http://jsfiddle.net/DwheG/</a></p>
  
  <p>What I'm asking is:</p>
  
  <ol>
  <li>am I even modeling stuff correctly?</li>
  <li>how do I bind the child controller's content? Do I have to use a string? Passing in objects (<code>this</code>) hasn't worked for me. Is Ember's path resolution algo documented anywhere?</li>
  <li>how do I bind the nested collection helper to the nested controller?</li>
  </ol>