Refresh model when the queryParam of a parent route changes

Hello I have the case that I have a “queryParam” on the application route called location_id.

I want the model of some child routes to refresh, when the queryParameter from the applicationRoute changes. So add to the child routes:

    queryParams: {
        location_id:  { refreshModel:true }

I get an error:

    You're not allowed to have more than one controller property map to the same query param key.

I created a twittle:

Any ideas?

When I did the same thing I had to put the refreshModel: true on the parent route not the child routes and this still caused the child routes’ model hooks to also refresh. I also used this.paramsFor(‘parant-route-name’) instead of transition.queryParams. I also injected the parrent controller into the child controllers. I did not put any queryParams on the child routes or controllers.

1 Like

Damn it @sukima . You are my hero of the day. I thought the refresh would only happen, if the model is inherited. I never thought it’d be that easy. I found a user asking the same thing on StackOverflow. I will direct him to your post.

Many thanks