If I pass the data from the Route’s model as well as the controller, which of them will be used? Say for example, I pass value=A from route and value=B from the controller and when the value is accessed which one will be printed?
As far as I know, what is actually happening when you enter a route is:
The route model() hook is called
Once that resolves, the route setupController(controller, model) hook is called, which by default basically does set(controller, 'model', model)
So I guess the route will overwrite whatever you set as model on the controller once the user navigates there. Also see Route - 3.7 - Ember API Documentation for details on that
Thanks for your reply !
So as you said, the setupController hook will be called after the model hook. In the setup controller method, I’m passing the model for that particular controller. How to access the model that is passed from the route in the controller? Which hook to use ?
In the controller you can just access it via this.model. There is no hook on the controller for that, any setup you need to do based on this can/should be done on the route. E.g. if you want the setupMyModel() method on the controller to be run, you could have a setupController method on the route like this: