ngIf display code example
Example 1: ngif else
<div *ngIf="isLoggedIn; else loggedOut">
Welcome back, friend.
</div>
<ng-template #loggedOut>
Please friend, login.
</ng-template>
Example 2: ng if
<ng-template [ngIf]="heroes" [ngIfElse]="loading">
<div class="hero-list">
...
</div>
</ng-template>
<ng-template #loading>
<div>Loading...</div>
</ng-template>