Answers for "ng if else in angular 8 short"

13

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>
Posted by: Guest on March-03-2020
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

Browse Popular Code Answers by Language