javascriptangulartypescriptangular-binding

How to bind the the value in Angular


I have below template, how to bind the defaultRelatedGuideUrl from the controller to the template?

[routerLink]="(editMode || readOnly) ? [] : ['/defaultRelatedGuideUrl/', link.slug]">

Controller:

@Input() defaultRelatedGuideUrl = 'myparam';

Solution

  • Use this syntax:

    [routerLink]="(editMode || readOnly) ? [] : ['', defaultRelatedGuideUrl, link.slug]">