What is the difference between using setupController as opposed to setting the model property. I saw this in the Peepcode screencast and am trying to figure out why I would use each approach. Doesn’t this do the same thing as just setting model: food?
// from the peepcode screencast (excellent by the way)
App.ApplicationRoute = Ember.Route.extend({
setupController: function(){
this.controllerFor('food').set('model',App.Food.find());
}
});
It’s worth noting that the model hook is actually the same thing as deserialize (only that deserialize is a private API).
For example if you transition with a context the model hook will not get called. It also gets called before setupController on all nested routes, which means you can’t use this.controllerFor inside the model hook.