ngif
ngIf is a structural directive in Angular used to conditionally include or exclude a portion of a template from the DOM. It evaluates a boolean expression and, if the result is truthy, renders the associated template; if false, the template is removed from the DOM. This approach differs from simply hiding an element with CSS, because the element and its children are created or destroyed by Angular.
In practice, ngIf is applied to an element in a template using the *ngIf syntax, for example
ngIf is part of the CommonModule, and you need to import this module (or a module that
Historically, ngIf is a feature of Angular (2 and later) and should not be confused with the