Generally the setupController
hook is the appropriate place to do this, since you'll generally be attaching this reference data to the controller for use there. Although, you can block the transition by returning a promise to the afterModel
hook, if you need this data to be available before the controller is set up, though you'll need to keep track of the values in the route, then manually assign them in setupController
.
setupController: function(controller, model){
this._super(controller, model);
controller.set('stuff', this.store.find('stuff', {site : site.get('id')}));
}
or if you use afterModel
afterModel : function(site, transition) {
var self = this,
store = this.store;
return Em.RSVP.hash({
stuff: store.find('stuff', {site : site.get('id')}),
more: store.find('moreStuff')
}).then(function(hash){
self.set('extraCrap', hash);
});
},
setupController: function(controller, model){
this._super(controller, model);
controller.set('stuff', this.get('extraCrap.stuff'));
}
You can also look at this, but be sure to read the second answer: EmberJS: How to load multiple models on the same route?