Ember nested route. Load more models
- by user3568719
JsBin http://jsbin.com/EveQOke/153/
I know how to load more then one model to a route, using Ember.RSVP.hash. (see Jsbin Children menu).
I use dynamic part to access one elem from a collection children/1.
But i cant load more models to a nested resource.
In my example i want to populate all the toys for a select, not just list the toys of the child.
I have tried to access the model of the route children
App.ChildRoute = Ember.Route.extend({
model: function(param){
return Ember.RSVP.hash({
allToys: this.modelFor("children"),
child:this.store.find('child', param.child_id)
});
}
});
and use its model's toy property (since there have already loaded all of the toys)
child.hbs
<h4>All avaiable toys</h4>
<table>
{{#each toy in model.allToys.toys}}
<tr>
<td>{{toy.name}}</td>
</tr>
{{/each}}
</table>