I want to pass a query parameter prop=xxx
.
This didn't work
<a [routerLink]="['/somepath', {queryParams: {prop: 'xxx'}}]">
Somewhere
</a>
angularangular2-routing
I want to pass a query parameter prop=xxx
.
This didn't work
<a [routerLink]="['/somepath', {queryParams: {prop: 'xxx'}}]">
Somewhere
</a>
Best Answer
queryParams
queryParams
is another input ofrouterLink
where they can be passed likefragment
routerLinkActiveOptions
To also get routes active class set on parent routes:
To pass query parameters to
this.router.navigate(...)
useSee also https://angular.io/guide/router#query-parameters-and-fragments