backbone-query-parameters icon indicating copy to clipboard operation
backbone-query-parameters copied to clipboard

Query Params loaded into key named "undefined" on params hash..

Open joshuaballoch opened this issue 11 years ago • 1 comments

I have tried out this plugin,

  1. included backbone-query-parameters and the shim js files on a Backbone v1.1 project
  2. I have a router ( in Coffeescript:)
  routes: {
    "workspaces/:id/library": "index"
  },
  index: function(route, params) {
     console.log(params);
  }

I expect: that params should include the query params in the params object

I get: that the query params are on the params object, but under a key "undefined"

For example:

screen shot 2014-01-06 at 2 36 19 pm

screen shot 2014-01-06 at 2 36 14 pm

This strikes me as a poor namespace to place the query params under. However, maybe I'm setting this up wrong. Is this the expected behaviour of this plugin?

joshuaballoch avatar Jan 06 '14 06:01 joshuaballoch

This looks like a bug. If the route is #foo?a=b then the params hash should look like {a: 'b'}. I'm not sure how this plugin functions under backbone 1.1 as I have not tested that so that could be the problem. Feel free to submit a pull request.

jhudson8 avatar Jan 07 '14 15:01 jhudson8