question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

routerLinkActive with [queryParams] is broken (worked in v2.0.2)

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] 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 routerLinkActive of a child route with queryParams is not working when reloading the page with the params (it is working if you click the link). The ‘a’ element doesn’t receive the class provided to the routerLinkActive when the route match. This worked in version 2.0.2 and was broken between that version and version 2.2.1.

Expected behavior When the route match, the ‘a’ element will receive the class provided to routerLinkActive.

Minimal reproduction of the problem with instructions <a class=“item” [routerLink]=“[‘/insights’]” [queryParams]=“{id: myid}” routerLinkActive=“tab-active” [routerLinkActiveOptions]=“{exact: true}”> Link

the following route will not match the routerLinkActive http://localhost:4200/#/insights?id=aa

Please tell us about your environment: Tested in chrome only mac os sierra

  • Angular version: 2.0.X I first spotted the issue in angular 2.2.1 (worked in older version - “2.0.2”). also broken on latest 2.2.3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
vicbcommented, Dec 1, 2016

We will consider adding a ignoreQueryParams to the directive.

4reactions
bes1002tcommented, Sep 29, 2020

any progress?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use "routerLinkActive" with query params in Angular 6?
RouteLinkActive will work only with exact query params. You may try passing {exact: false} as routerLinkActiveOptions. If that doesn't work.
Read more >
Routing & Navigation - ts - GUIDE - Angular
The RouterLinkActive directive on each anchor tag helps visually distinguish the anchor for the currently selected "active" route. The router adds the ...
Read more >
How to Mark a Link as Active in Angular, Even if the Query ...
We achieve this by putting the RouterLinkActive directive on the link in question; ... But what if there are query params in your...
Read more >
Angular Router Query Params Relative Routing - StackBlitz
<a routerLinkActive="active". routerLink="/home/catalog" [queryParams]=". {slide:2}">Catalog Params</a>. <router-outlet></router-outlet>.
Read more >
routerlinkactive not working with queryparams
routerlinkactive not working with queryparams. 6f20ce8. …in arrays The url_tree equalQueryParams and containsQueryParam methods did not handle query params ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found