How do you put a parameter into a routerlink
.
I'm trying to do something like this:
<p *ngFor="let supplier of suppliers">
<a [routerLink]="['/supplier/{{supplier.businessId}}/products']">
View Products
</a>
</p>
You can access query params in routerlink like below.
<a routerLink="/product/productDetails/{{item.product.id}}" title="Edit"> <span class="glyphicon glyphicon-pencil"></span> </a>
What is difference between routerLink and [routerLink] ?
As per your question in routerLink you can directly use queryparams as shown in above code but in [routerLink] you can set queryparams like this.
<a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education">
link to user component
</a>
For more information visit this link : https://angular.io/api/router/RouterLink
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With