When you put square brackets around routerLink
(or any Angular binding) it will evaluate what you pass to it as a JavaScript expression. If you don’t put square brackets around routerLink
it will take what you pass it as a literal string.
So if you want to pass an array to routerLink or evaluate a variable then you would have to use square brackets. If you want to pass a string you could either do
<a routerLink="/path">
OR
<a [routerLink]="'/path'">