For the More Curious: setupController and afterModel

The hook setupController is for setting properties on a controller that will render those properties. It is possible to run the default behavior of setting the controller’s model property while setting other active controller properties with this._super:

setupController(controller, model) {
  this._super(controller, model);
  // this.controllerFor('[other controller]').set("[property name]", [value]);
}

The hook afterModel is run after the model hook (which is a Promise) is resolved. Note that there are special cases where the model hook would not be called because the Promise has already been resolved. In these cases, afterModel is called before setupController and can be used as a method to test the integrity of the model data before passing it to the controller.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.154.252