It’s quite easy to get the dynamic segment and query params values on the ItemsListController, and ItemsListRoute, as described on the Ember docs.
However, what if I want to get the segment or query params values from the items controller?. Is it possible to do this, or should I structure the routes differently to achieve it?
It’s quite easy to get the dynamic segment and query params values on the ItemsListController, and ItemsListRoute, as described on the Ember docs.
From within your ItemController you can access the parent controller via this.parentController. And then you can use whatever strategy you have for reading the queryParams off the controller. I assume it would be as simple as:
Thanks @jasonmit! , but I’m not completely sure if I get what you said. On this case is the opposite, I cannot get the values on the child route from its parent. I’m linking to the route like this:
/ linking from a menu in items template to the list route
link-to 'items.list' 'used' (query-params page=1)
| Used Items
So I don’t understand how this.parentController.getProperties would work. Should the routes remain the same to work?
Or, should I use a single route and render the ItemsListController inside the Items template to get the params as you mentioned?
I thought you were having issues around the use of an ArrayController. Could you fiddle your example using Ember Latest - JSFiddle - Code Playground and I’ll see what I can do to get it to work?