1.

Write the syntax for ngIf Directive. Why is it used?

Answer»

<P>The syntax of the ngIf Directive is given below

&LT;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.



Discussion

No Comment Found