Ember nested route. Load more models
Posted
by
user3568719
on Stack Overflow
See other posts from Stack Overflow
or by user3568719
Published on 2014-06-04T20:55:00Z
Indexed on
2014/06/04
21:24 UTC
Read the original article
Hit count: 263
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>
© Stack Overflow or respective owner