
Concept – To use if and else within our templates.
Example –
<div><ng-template [ngIf]="counter > 4" [ngIfElse]="none"> <p>The click counter <strong>IS GREATER</strong> than 4.</p></ng-template>
<ng-template #none><p>The click counter is <strong>not greater</strong> than 4.</p> </ng-template> </div>
Step 1- Use property binding [ngIf] and bind it to expression counter > 4.
Step 2- If that expression is true, it will show the HTML within the initial ng-template block.
Step 3– If that expression isn’t true, it will call none with ngIfElse.
Step 4- And it shows the template defined by #none beneath it!