angular-routerlink

Difference between [routerLink] and routerLink

霸气de小男生 提交于 2019-11-28 16:47:18
What is the difference between [routerLink] and routerLink ? How should you use each one? Milad You'll see this in all the directives: When you use brackets, it means you're passing a bindable property (a variable). <a [routerLink]="routerLinkVariable"></a> So this variable (routerLinkVariable) could be defined inside your class and it should have a value like below: export class myComponent { public routerLinkVariable = "/home"; // the value of the variable is string! But with variables, you have the opportunity to make it dynamic right? export class myComponent { public routerLinkVariable =

Difference between [routerLink] and routerLink

不羁岁月 提交于 2019-11-27 00:09:07
问题 What is the difference between [routerLink] and routerLink ? How should you use each one? 回答1: You'll see this in all the directives: When you use brackets, it means you're passing a bindable property (a variable). <a [routerLink]="routerLinkVariable"></a> So this variable (routerLinkVariable) could be defined inside your class and it should have a value like below: export class myComponent { public routerLinkVariable = "/home"; // the value of the variable is string! But with variables, you