![]() |
VOOZH | about |
In this article, we are going to see what is NgIf in Angular 10 and how to use it.
The ngIf Directive in Angular10 is used to remove or recreate a portion of HTML element based on an expression. If the expression inside it is false then the element is removed and if it is true then the element is added to the DOM.
Syntax:
<li *ngIf='condition'></li>
NgModule: Module used by NgIf is:
Selectors:
Approach:
Example 1:
Output:
👁 ImageExample 2:
Output:
👁 ImageReference: https://v17.angular.io/api/common/NgIf