xxxxxxxxxx
<div *ngIf="isValid;else other_content">
content here
</div>
<ng-template #other_content>other content here...</ng-template>
xxxxxxxxxx
<div *ngIf="isLoggedIn; else loggedOut">
Welcome back, friend.
</div>
<ng-template #loggedOut>
Please friend, login.
</ng-template>
xxxxxxxxxx
<div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
xxxxxxxxxx
<ng-container *ngIf="isDone; else elseNotDone">
It's Done!
</ng-container>
<ng-template #elseNotDone>
It's Not Done!
</ng-template>
xxxxxxxxxx
<div *ngIf="isLoggedIn; else loggedOut">
Welcome back, friend.
</div>
<ng-template #loggedOut>
Please friend, login.
</ng-template>
xxxxxxxxxx
<div *ngIf="condition; else elseBlock">
Content to render when condition is true.
</div>
<ng-template #elseBlock>
Content to render when condition is false.
</ng-template>
xxxxxxxxxx
<div *ngIf="condition; then thenBlock else elseBlock"></div>
<ng-template #thenBlock>Content to render when condition is true.</ng-template>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
xxxxxxxxxx
content_copy
<div *ngIf="condition; then thenBlock else elseBlock"></div>
<ng-template #thenBlock>Content to render when condition is true.</ng-template>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
xxxxxxxxxx
<ng-container *ngIf="foo === 1;else second"></ng-container>
<ng-template #second>
<ng-container *ngIf="foo === 2;else third"></ng-container>
</ng-template>
<ng-template #third></ng-template>
ngif else if
xxxxxxxxxx
<div *ngIf="isLoogedIn; else isLoogedOut">
Hello Admin
</div>
<ng-template #isLoogedOut>
Hello Gust
</ng-template>
xxxxxxxxxx
<div *ngIf="isValid;else other_content">
content here
</div>
<ng-template #other_content>other content here...</ng-template>
<div *ngIf="isValid;then content else other_content">here is ignored</div>
<ng-template #content>content here...</ng-template>
<ng-template #other_content>other content here...</ng-template>
<div *ngIf="isValid;then content"></div>
<ng-template #content>content here...</ng-template>