ngIf Structural Directive

ngIf directive is used when we want to show or hide html element based on a given condition.

Some examples are:

<div *ngIf="1 == 1"></div> 
 <!-- This will always visible since 1 == 1 is always true -->

 <div *ngIf="1 == 2"></div> 
 <!-- This will never visible because 1 == 2 is always false -->

 <div *ngIf="a > b"></div> 
 <!-- This will be visible if 'a' is greater then 'b' -->

results matching ""

    No results matching ""