lundi 23 janvier 2017

What is the correct way to access the model from a controller in Ember

I was wondering what the correct way to access the model from the controller?

I noticed that in the init of the controller the model is still null

#controller.js

init(){
  console.log(this.model); // IS NULL
}

But the setupController method has the populated model. Therefore currently I am calling a controller's method from the setupController and an passing the model over there. Is this fine?

I was thinking there would be a callback method in the controller which would automatically be called when the controller is setup.




Aucun commentaire:

Enregistrer un commentaire