angular hide button 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: hide and show in angular 8

isShown: boolean = false ; // hidden by default


toggleShow() {

this.isShown = ! this.isShown;

}

Example 3: hide element when pressing button angular

<div class="yourCssClass" *ngIf="this.isButtonVisible" (click)="this.isButtonVisible = false">
...
</div>

Your TypeScript

export class AppComponent {
   private isButtonVisible = true;
}

Example 4: hide button in typescript

var link = document.getElementById('nav-ask');
link.style.display = 'none'; //or
link.style.visibility = 'hidden';