I'm having hard times at understanding if a route is active or not, regardless of optional URL parameters (that can be query parameters
, hash
and so on).
When I set {exact: true}
as routerLinkActiveOptions
and I go to /login, then [routerLinkActive]
or router.isActive('/login')
will return true
as expected.
But if I add some query param to the url, like /login?err=something_happened
, then they will return false
, but I expect it to returns true
as well.
Therefore, if there are query params in the URL then none of the items in the navbar will have applied the specified classes, and this is just not what a user expects.
I could also write that method by myself but I prefer an Angular solution, particularly because there are many standards for URL parameters so it wouldn't be easy to implement.
This question didn't help me, though it provides many solutions.
Do you know a way to accomplish it?