In Ember 2, for a URL with a query string of ?q[a]=1&q[b]=2
, how do I get those params in the controller?
I'm able to get a single string (q=foo
) and an array (q[]=1&q[]=2
), but I'm unable to get an object like mentioned above.
In Ember 2, for a URL with a query string of ?q[a]=1&q[b]=2
, how do I get those params in the controller?
I'm able to get a single string (q=foo
) and an array (q[]=1&q[]=2
), but I'm unable to get an object like mentioned above.
you can access the parameters in the route
and sending them to the controller
by:
setupController(controller, model, transition) {
this._super(...arguments);
// transition.params contains params in the url
// this.get('router.url') contains all query params
// your method in the controller to handle the params
controller.setQueryParams( ...your params... );
}