Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding child views and collections within an outlet in emberjs
    primarykey
    data
    text
    <p>I'm trying to render a view <code>Team</code> inside of an <code>{{outlet}}</code>. This <code>Team</code> view is comprised of a simple <code>Person</code> view (the team leader), and a collection of <code>Person</code> views (team members). The outlet is set up by calling <code>connectOutlet()</code> on the ApplicationController.</p> <p>Although the <code>Person</code> child views are rendered in the markup as expected, all the values of <code>name</code> are missing. It sure seems like my bindings and/or controller are not set up properly. What am I missing?</p> <p>Code and demo: <a href="http://jsfiddle.net/aek38/fkKFJ/" rel="nofollow">http://jsfiddle.net/aek38/fkKFJ/</a></p> <p>The relevant handlebar templates are:</p> <pre><code>&lt;script type="text/x-handlebars" data-template-name="app"&gt; &lt;div class="container"&gt; {{outlet}} &lt;/div&gt; &lt;/script&gt; &lt;script type="text/x-handlebars" data-template-name="person"&gt; &lt;em&gt;Person name is:&lt;/em&gt; {{name}} &lt;/script&gt; &lt;script type="text/x-handlebars" data-template-name="team"&gt; &lt;h3&gt;Team Leader&lt;/h3&gt; &lt;em&gt;Leader name should be:&lt;/em&gt;{{leader.name}} {{view App.PersonView contentBinding="leader"}} &lt;h3&gt;Team Members&lt;/h3&gt; {{#collection contentBinding="members"}} {{view App.PersonView contentBinding="content"}} {{/collection}} &lt;/script&gt; </code></pre> <p>Code snippet:</p> <pre><code>App = Ember.Application.create({ ready: function() { this.initialize(); }, ApplicationController: Ember.Controller.extend(), ApplicationView: Ember.View.extend({ templateName: "app" }), Person: Ember.Object.extend({ name: "Jane Doe" }), PersonController: Ember.ObjectController.extend(), PersonView: Ember.View.extend({ templateName: "person" }), Team: Ember.Object.extend({ members: [], leader: null }), TeamController: Ember.ObjectController.extend(), TeamView: Ember.View.extend({ templateName: "team" }), // ... </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload