ember.js - Do you need to set the model on the controller when using setupController on Ember.Route? -


i have been having confusion in regards ember.route model vs. setupcontroller. have example app here:

http://jsbin.com/ihakop/5/edit

i wondering why need add following (see inline comment)

app.appsshowroute = ember.route.extend({   model: function(params) {     return app.ltiapp.find(params.id);   },    setupcontroller: function(controller, model) {     controller.set('reviews', app.review.find());      // why line needed? shouldn't have model     // on controller?     controller.set('model', model);   } }); 

shouldn't model on controller?

this question. behaviour introduced rc4. have @ blog post explanation. recommendation of ember guys add call _super():

app.appsshowroute = ember.route.extend({   model: function(params) {     return app.ltiapp.find(params.id);   },    setupcontroller: function(controller, model) {      this._super(controller, model);      controller.set('reviews', app.review.find());   } }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -