I have the following route in Angular 7:
<a [routerLink]="['/categories', {{ category.name | slugify }}, category.id]">{{category.name}}</a>
The problem is with applying the pipe slugify
within the routerlink
.
How can I apply a pipe to a value inside routerLink
?
Try removing the curly brackets like this:
<a [routerLink]="['/categories', category.name | slugify, category.id]">{{category.name}}</a>
You don't need them there because you are using property binding which is already evaluating to TypeScript code.