Skip to main content

Posts

Showing posts with the label Angular 4 NgSwitch

Angular 4 and 5 NgIf and NgSwitch Examples

The Angular *NgIf directive is used when we wants to remove/display an elements from the DOM based on our condition. If your condition is false [ *ngIf='false' ] the element the directive is attached to will be removed from DOM . What Are the Difference Between [hidden] = 'false' and *ngIf = 'false' ? The [hidden] = ‘false’ is used to simply hides the elements but the *ngIf= ‘false’ is used to removes the element completely from the DOM when the condition is not true. See the below examples – Used of Angular *NgIf import { NgModule , Component } from '@angular/core' ; import { BrowserModule } from '@angular/platform-browser' ; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' ; @ Component ({   selector: 'ngif' ,   template: `       <h4>NgIf</h4>       <ul *ngFor="let person of people">         <l...