How to pass parent route property to child route to be used in as parameter in model hook


I am beginner in Ember.js. Here is the problem I am facing Simple parent-child routes without any params is setup. Trying to avoid child route query parameters as they show up in URL. /car route template contains: Car size dropdown component at top 4 buttons with 4 vendor names, click on button shows data below for that vendor. vendors data is implemented as routes. So each button calls a link-to route – /car/vendor1 – /car/vendor2 Idea is car size selection changes will change the vendor data. Vendor data is fetched using ember data. model() hook. The car size parameter is used in Ember data fetch query. Car size selection change is propagated to /car route action correctly. So /car route contains selected car size property.

How to pass this car size property to current child route? So if I am currently seeing vendor1 data then just changing car size selection doesn’t change the route but still I want to invoke /car/vendor1 model hook.

Alternately tried to access the property in setupController of /car/vendor1 using this.controllerFor(parent) but not sure how to fire model hook.


Create a car-size service in the top and insert it in the top component. Like this:

On any controller that needs car-size you can inject the service like this.


Thanks. Alternately component passing the car size selection to route is working but I will try out the service approach.

But my main problem is how to invoke the model() hook with this parameter dynamically. I mean first time is fine but later once the car size selection is modifed how to invoke model() hook with that parameters.


But my main problem is how to invoke the model() hook with this parameter dynamically.

It sounds like a use case for queryParams.

Could you reproduce your problem on github?


Try using this.modelFor('') in your child route’s model hook. It will retrieve the model from the parent route when needed (instead of requiring you to pass down the model to the child route).