I am really confused whether I should be using
<a routerLink="/about">About</a>
or
<a [routerLink]="['/about']">About</a>
Both are correct.
<a routerLink="/about">About</a>
and
<a [routerLink]="'/about'">About</a>
pass a path as string
while
<a [routerLink]="['/about']">About</a>
passes an array of router commands.
Both are supported.
https://github.com/angular/angular/blob/9d9e9c6ff1eb37d54a6e4af0a88f05a41f75d7a9/modules/%40angular/router/src/directives/router_link.ts#L85
@Input() set routerLink(data: any[]|string) {
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