hide a component in angular code example

Example 1: hide and show in angular 8

<button (click)="toggleShow()" type="checkbox" >show/hide</button>

<div *ngIf="isShown" class="row container-fluid"  id="divshow" >
Div Content

</div>

Example 2: angular hide element from component when on certain page

// in .component.ts file
import { Router } from '@angular/router';

export class ExampleComponent {
	constructor(private _router: Router) {}
}

// in html file
<footer *ngIf="_router.url != '/your-route'"></footer>

Example 3: hide and show in angular 8

/* Component */
isShown: boolean;

ngOnInit(){
  isShown = false; //hidden every time subscribe detects change
}

toggleShow() {
  this.isShown = ! this.isShown;
}

/* Template */
<div *ngIf="isShown" class="row container-fluid" id="divshow">
  content
</div>