{"action":"created","issue":{"url":"https://api.github.com/repos/BlueSpire/Durandal/issues/625","labels_url":"https://api.github.com/repos/BlueSpire/Durandal/issues/625/labels{/name}","comments_url":"https://api.github.com/repos/BlueSpire/Durandal/issues/625/comments","events_url":"https://api.github.com/repos/BlueSpire/Durandal/issues/625/events","html_url":"https://github.com/BlueSpire/Durandal/issues/625","id":56666755,"number":625,"title":"Router module removes empty URL parameters from activation parameters","user":{"login":"ashrafsabrym","id":1023731,"avatar_url":"https://avatars.githubusercontent.com/u/1023731?v=3","gravatar_id":"","url":"https://api.github.com/users/ashrafsabrym","html_url":"https://github.com/ashrafsabrym","followers_url":"https://api.github.com/users/ashrafsabrym/followers","following_url":"https://api.github.com/users/ashrafsabrym/following{/other_user}","gists_url":"https://api.github.com/users/ashrafsabrym/gists{/gist_id}","starred_url":"https://api.github.com/users/ashrafsabrym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashrafsabrym/subscriptions","organizations_url":"https://api.github.com/users/ashrafsabrym/orgs","repos_url":"https://api.github.com/users/ashrafsabrym/repos","events_url":"https://api.github.com/users/ashrafsabrym/events{/privacy}","received_events_url":"https://api.github.com/users/ashrafsabrym/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-05T12:56:41Z","updated_at":"2015-02-05T16:33:33Z","closed_at":null,"body":"I have the following navigation operation:\r\n```javascript\r\nrouter.navigate(\"account-receivable/sales-details?\" + $.param({\r\n            branchId: branchId\r\n        }));\r\n```\r\nWhen `branchId` is `null` the resulting query string is `branchId=`.\r\nIn the router module, `router.parseQueryString` causes this null value to be removed altogether from the parameters passed to the module I navigate to, which is not desirable, as I want the parameter to be passed as null, as this has special meaning to the other module.\r\nI had to modify line 557 in router.js as follows:\r\n`value = (parts[1] && decodeURIComponent(parts[1].replace(/\\+/g, ' '))) || null;`\r\nI added the `|| null` part. Before this fix, `value` gets the value of `undefined` which makes the key not to be added to the query object."},"comment":{"url":"https://api.github.com/repos/BlueSpire/Durandal/issues/comments/73077620","html_url":"https://github.com/BlueSpire/Durandal/issues/625#issuecomment-73077620","issue_url":"https://api.github.com/repos/BlueSpire/Durandal/issues/625","id":73077620,"user":{"login":"ashrafsabrym","id":1023731,"avatar_url":"https://avatars.githubusercontent.com/u/1023731?v=3","gravatar_id":"","url":"https://api.github.com/users/ashrafsabrym","html_url":"https://github.com/ashrafsabrym","followers_url":"https://api.github.com/users/ashrafsabrym/followers","following_url":"https://api.github.com/users/ashrafsabrym/following{/other_user}","gists_url":"https://api.github.com/users/ashrafsabrym/gists{/gist_id}","starred_url":"https://api.github.com/users/ashrafsabrym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashrafsabrym/subscriptions","organizations_url":"https://api.github.com/users/ashrafsabrym/orgs","repos_url":"https://api.github.com/users/ashrafsabrym/repos","events_url":"https://api.github.com/users/ashrafsabrym/events{/privacy}","received_events_url":"https://api.github.com/users/ashrafsabrym/received_events","type":"User","site_admin":false},"created_at":"2015-02-05T16:33:33Z","updated_at":"2015-02-05T16:33:33Z","body":"The expression in router.parseQueryString tests for truthy values, so, even using an empty string won't work (the regex sets parts[1] to `undefined`).\r\nNull makes sense for this view model. It means \"search for all branches\". I don't like sending special values like 0 or -1. I want to send an empty URL parameter the same way we do with web handlers URLs."}}