0

what is the difference between [routerLink] and routerLink in angular routing ? and what is the benifits for each one and what I should use

know the difference

anas mk
  • 9
  • 1
  • 2
  • `[routerLink]` indicates the value you will provide is dynamic, otherwise it's a static value. This is true of any property in Angular. – Brandon Taylor Oct 31 '22 at 17:07
  • Does this answer your question? [What is the difference between parentheses, brackets and asterisks in Angular2?](https://stackoverflow.com/questions/35944749/what-is-the-difference-between-parentheses-brackets-and-asterisks-in-angular2) – Tanner Oct 31 '22 at 17:08

1 Answers1

4

From the docs:

The brackets, [], cause Angular to evaluate the right-hand side of the assignment as a dynamic expression. Without the brackets, Angular treats the right-hand side as a string literal and sets the property to that static value.

Garuno
  • 1,935
  • 1
  • 9
  • 20