The syntax of the ngIf Directive is given below
<p *ngIf="condition"> condition is true and ngIf is true. </p> <p *ngIf="!condition"> condition is false and ngIf is false. </p>
The usage of ngIf is described below –
It is a structural directive present in Angular Version 8 whose usage revolves around adding or removing HTML elements based on the expression statement. The functioning of this nglf directive is observed as follows: When the expression is true, the element is added and when the expression is false, the element is removed using this directive.