Skip to content

Router: Query params are removed when using preserveQueryParams #13806

@brandonroberts

Description

@brandonroberts

I'm submitting a ... (check one with "x")

[] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
On a routerLink, if queryParams and preserveQueryParams are used together, the query parameters are not adding to the routerLink.

Expected behavior

Query params are still added to the href even if preserveQueryParams is set.

Minimal reproduction of the problem with instructions

https://plnkr.co/edit/CF3LxPo2XXWYdb40vDwb?p=preview

Run plunker
Note the two links
The first link has no preserveQueryParams set, and hovering over the link shows a query string of ?filter=true
The second link has preserveQueryParams set, and hovering over the link shows no query params.

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • Angular version: 2.0.X

Angular 2.4.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

cc @DeborahK

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions