I am experimenting with a new router (version 3.0.0-alpha.7) and would like to know how to specify request parameters using the routerLink directive?
The Router.navigate () method below generates a URL, for example http: // localhost: 3000 / component-a? X = 1
this.router.navigate(['/component-a'], {queryParams: {x: 1}});
However, I cannot figure out how to do the same with the routerLink directive. A template like the one below returns a parser error ...
<a [routerLink]="['/component-a'], {queryParams: {x: 1}}">Component A</a>
And the closest I can get is http: // localhost: 3000 / component-a; x = 1 , which uses the syntax for the child route.
<a [routerLink]="['/component-a', {x:1}]">Component A</a>
source share