[repost ]How to use multiple models with a single route in EmberJS / Ember Data?
original:http://ift.tt/1uV8XYi answer: You can use the Ember.RSVP.hash to load several models: App.IndexRoute = Ember.Route.extend({ model: function() { return Ember.RSVP.hash({ people: this.store.find('person'), companies: this.store.find('company') }) } }); And in your template you can refer to people and companies to get the loaded data: <script type="text/x-handlebars" data-template-name="index"> <h2>People:</h2> <ul> {{#each people}} <li>{{name}}</li> {{/each}} </ul> <h2>Companies:</h2> <ul> {{#each […]
via WordPress http://ift.tt/14fh76G
via WordPress http://ift.tt/14fh76G
Labels: hanhuiwen
0 Comments:
Post a Comment
<< Home