router.isActive and routerLinkActive to support more options
See original GitHub issueCurrently router.isActive and routerLinkActive support only one option exact:boolean
.
When exact = true
, isActive will return true if:
- queryParams match exactly
- the url has the same url segments with all “path” equal
- matrix params are ignored
When exact = false
, isActive will return true if:
- The queryParams of the containee is a subset of the queryParams of the container
- The url tree of the containee is a subtree of the url tree of the container
- Matrix params are ignored
We should replace the exact=true
with a string type that supports more options:
- Include/exclude queryParams
- Include/exclude fragment
- Include/exclude matrix params
Issue Analytics
- State:
- Created 7 years ago
- Reactions:203
- Comments:42 (6 by maintainers)
Top Results From Across the Web
RouterLinkActive - Angular
Options to configure how to determine if the router link is active. ... You can set more than one class using a space-separated...
Read more >In Angular, how do you determine the active route?
With the new Angular router, you can add a [routerLinkActive]="['your-class-name']" attribute to all your links: <a [routerLink]="['/home']" ...
Read more >New Angular Router features in versions 7, 8, and 9 - Medium
Catch up on the latest Angular Router features: Dynamic imports to lazy load modules, advanced route guards, routerLinkActive improvements.
Read more >What's new in Angular 12.0? - Ninja Squad
routerLinkActive has more fine-tuned options. The router offers a directive called routerLinkActive to add a CSS class to the link if it points ......
Read more >Mastering RouterLink - Briebug Blog
The RouterLink directive translates the given route into an href ... There is another, more flexible syntax for routes: the "array" syntax.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A workaround for ignoring the
queryParams
forrouterActive
withexact: true
would be to create your own condition to check if the current URL without the query params is equal to therouterLink
.Still waiting… This is really annoying