Hello Devs, 

In this tutorial, we will learn Angular 9/8/7 NgIf Directive Example

You can easily use ng if in angular 6, angular 7, angular 8 and angular 9 example.

Follow this step by step guide below. 



src/app/app.component.ts

import { Component } from '@angular/core';

  

@Component({

  selector: 'my-app',

  templateUrl: './app.component.html',

  styleUrls: [ './app.component.css' ]

})

export class AppComponent  {

  

  isShow: boolean = true;

}



src/app/app.component.html

<h1>Angular ngIf else Example - rathorji.in</h1>

  

<p *ngIf="isShow">Show this only if "show" is true</p>


May this example help you.