header.component.html
<ng-container *ngFor="let headerMenu of headerMenus">
<li *ngIf="headerMenu.ngif">
<a (click)="onClick(headerMenu.menu)" [class]="headerMenu.menu">
<img [src]="headerMenu.src" [alt]="headerMenu.menu">
<p>{{ headerMenu.menu | uppercase }}</p>
</a>
</li>
</ng-container>
headerMenu.service.ts
public headerMenus: HeaderMenu[] = [
// menu, srcURL, ngif
new HeaderMenu('service', 'assets/img/service.png', true),
new HeaderMenu('pricing', 'assets/img/pricing.png', true),
new HeaderMenu('source', 'assets/img/source.png', true),
new HeaderMenu('about', 'assets/img/about.png', true),
new HeaderMenu('user', 'assets/img/user.png', 'isLoggedIn'),
new HeaderMenu('login', 'assets/img/login.png', 'isLoggedIn'),
];
I am attempting to pass the "isLoggedIn" variable to ngif as headerMenu.ngif. I expected "isLoggedIn" to function as a variable that could be toggled on and off depending on the login status.
However, it is being recognized as a string "isLoggedIn".
Is there a way for me to pass it as an actual variable?