I've read this question about how to determine the active route, but still it's not clear to me how to determine an active route with paramaters?
Right now I'm doing it like this:
<a [routerLink]="['/Profile/Feed', {username: username}]"
[ngClass]="{active: getLinkStyle('/profile/john_doe/feed')}">
Feed for {{username}}
</a>
And inside my component:
getLinkStyle(path:string):boolean {
console.log(this._location.path()); // logs: '/profile/john_doe/feed'
return this._location.path() === path;
}
And this will work because I'm passing the username as a string. Is there any way to do this with passing the correct parameter??