else if angular 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 else

<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>

Example 3: ngif using multiple elseif

<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>

Example 4: if angular

<div *ngIf="condition">Content to render when condition is true.</div>

Example 5: ng elseif

<ng-container *ngIf="tipo_template === 0">
     <!-- Conteúdo 0 aqui -->
</ng-container>

<ng-container *ngIf="tipo_template === 1">
     <!-- Conteúdo 1 aqui -->
</ng-container>

<ng-container *ngIf="tipo_template === 2">
     <!-- Conteúdo 2 aqui -->
</ng-container>

Tags:

Html Example