QueryParams - How to satisfy dynamic segments for route?

Hi,

I use QueryParams and now if I transition into this route i receive the following error:

Error: You didn’t provide enough string/numeric parameters to satisfy all of the dynamic segments for route XXX at Object.exports.default.subclass.createParamHandlerInfo (http://localhost:4200/assets/vendor.js:58323:21) at Object.exports.default.subclass.applyToHandlers (http://localhost:4200/assets/vendor.js:58202:37) at Object.exports.default.subclass.applyToState (http://localhost:4200/assets/vendor.js:58169:21) at Object.getTransitionByIntent (http://localhost:4200/assets/vendor.js:57330:29) at Object.Router.transitionByIntent (http://localhost:4200/assets/vendor.js:57442:40) at Object.Router.refresh (http://localhost:4200/assets/vendor.js:57541:21) at EmberObject.extend.refresh (http://localhost:4200/assets/vendor.js:36592:35) at EmberObject.extend._actions.queryParamsDidChange (http://localhost:4200/assets/vendor.js:36310:20) at Object.triggerEvent (http://localhost:4200/assets/vendor.js:38407:38) at trigger (http://localhost:4200/assets/vendor.js:58929:16)

The path element for the route you’re transitioning to expects one or more parameters that are part of the URL. Those are the dynamic segments. QueryParams are not part of the dynamic segments. In the URL, the queryParams go after the ?-mark, and the dynamic segments go before the ?-mark. That means you can’t replace the dynamic segments with queryParams as you like. You have to choose what kind of parameter it is.

The error therefor comes from you providing at least one too few parameters (before the ?-mark) for the route to complete the transition.

Thanks for your answer but I don’t think that this is my problem.

I use the refreshModel-property for a full transition if a queryParam changes. I commented this property out and now everything works.

Hello again,

does anybody has an idea why i can’t use refreshModel?

@dennismende were you able to solve this issue? I am seeing a similar issue.

Dealing with the same problem. Anyone has solved / workaround it?

Ok, turned out my problem could fixed quite easily still, this seems like an issue to me. I’m doing this on ember 1.7, anyone knows if this is still a problem in current release of Ember?

My solution:

  • have the query parameter set as {replace: true}
  • create an observer in the related controller to watch over the parameter
  • send a didChanged action to the route from the controller observer
  • call a this.refresh() on the didChanged route action

not so fancy but it’s working…