Search code examples
angularauth0routerlink

Using *ngIf with routerlink


How would I implement "ngif" to a routerlink instead of creating a button?

example: *ngIf="auth.isAuthenticated()" (click)="auth.logout()"

To: <a [routerLink]="['/']">Logout


Solution

  • Try this

    <span  *ngIf="auth.isAuthenticated()"><a [routerLink]="['/']">Logout</a></span>