How can I convert routerLink to href?

373 Views Asked by At

I have difficulty converting routerLink in href.

 <a [routerLink]="['/pick',{id:sizzle.parameter,type:food}]"

I tried, but its giving me error

<a [href]="'/pick'+id:sizzle.parameter+type:food"
1

There are 1 best solutions below

10
On

You should use routerLink for that. For example like this:

 <a [routerLink]="['/pick']" [queryParams]="{id: 1, food: 'pizza'}">Touch me</a>