问题
I'm trying to pass an id in my routerLink, how could I concatenate it?
<a routerLink="['/details', {{data.id}}]"> </a> doesnt work.
Do you have solutions?
Thanks in advance
回答1:
There you go.
<a [routerLink]="['/details', data.id]"> Link </a>
回答2:
Parameters go as second item in the array syntax to router link, like this:
[routerLink]="['/details', data.id]
Read more here
来源:https://stackoverflow.com/questions/53523472/angular-variable-into-routerlink