1<div *ngIf="isLoggedIn; else loggedOut">
2 Welcome back, friend.
3</div>
4
5<ng-template #loggedOut>
6 Please friend, login.
7</ng-template>
8
1<div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
2<ng-template #elseBlock>Content to render when condition is false.</ng-template>
1<ng-container
2 *ngIf="isLoggedIn; then loggedIn; else loggedOut">
3</ng-container>
4
5<ng-template #loggedIn>
6 <div>
7 Welcome back, friend.
8 </div>
9</ng-template>
10<ng-template #loggedOut>
11 <div>
12 Please friend, login.
13 </div>
14</ng-template>
15
1
2
3<ng-template [ngIf]="heroes" [ngIfElse]="loading">
4 <div class="hero-list">
5 ...
6 </div>
7</ng-template>
8
9<ng-template #loading>
10 <div>Loading...</div>
11</ng-template>
12