Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember query params for nested routes

I have the url /tests/test-slug?extradata=data all my params are setup correctly within ember. When that extradata param is set the model updates with the new data from the (/tests/test-slug?extradata=data) response. Usually I would retrieve data using ember-model by doing:

model: function (params) {
  return App.Test.findQuery(params);
}

But with the query parameter added to this nested url its giving me 'test-slug' as a param with the extradata and making a request to the server with: ?tests_slug=test-slug&extradata=data

Is there anyway I can use query params and update my model on a nested route?

Edit: this post explains it a lot better than me: Ember data - dynamic segments and query params together?

like image 999
Robert Avatar asked Nov 17 '25 19:11

Robert


1 Answers

Extend your route's params with the parant route's params and send that into .findQuery()

Ember.$.extend(params, this.paramsFor('parentRoute'));

More: http://emberjs.com/api/classes/Ember.Route.html#method_paramsFor

like image 95
encrypter8 Avatar answered Nov 19 '25 08:11

encrypter8