Answers for "*ngif and else in angular"

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>
Posted by: Guest on October-05-2020
1

ng if

<ng-template [ngIf]="heroes" [ngIfElse]="loading">
 <div class="hero-list">
  ...
 </div>
</ng-template>

<ng-template #loading>
 <div>Loading...</div>
</ng-template>
Posted by: Guest on September-30-2020

Browse Popular Code Answers by Language