Reputation: 3309
I angular1 I created a link with an ID Parameter like:
<a href="rbac/role/{{role.id}}/edit">edit</a>
In angular2, I've tried
<a [routerLink]="['rbac/role/{{role.rid}}/edit']">edit</a>
but get the error:
Parser Error: Got interpolation ({{}}) where expression was expected at column 12 in [['rbac/role/{{role.rid}}/edit']] in RolesViewComponent@18:23
How do I setup this link without calling a function of the Component to create it?
Thank You
Upvotes: 0
Views: 506
Reputation: 136134
You shouldn't be using {{}}
interpolation inside routerLink
directive, you need to make a slight change like below. Separate it with part, expression part will evaluate inside component context(this
) & thereafter all will get join with /
to form the URL.
<a [routerLink]="['rbac/role', role.rid, 'edit']">edit</a>
Upvotes: 3