Chris
0
Q:

angular show element in component

isShown: boolean = false ; // hidden by default


toggleShow() {

this.isShown = ! this.isShown;

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

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

</div>
2
isShown: boolean;

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

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

New to Communities?

Join the community