1<button (click)="toggleShow()" type="checkbox" >show/hide</button>
2
3<div *ngIf="isShown" class="row container-fluid" id="divshow" >
4Div Content
5
6</div>
1isShown: boolean = false ; // hidden by default
2
3
4toggleShow() {
5
6this.isShown = ! this.isShown;
7
8}
1/* Component */
2isShown: boolean;
3
4ngOnInit(){
5 isShown = false; //hidden every time subscribe detects change
6}
7
8toggleShow() {
9 this.isShown = ! this.isShown;
10}
11
12/* Template */
13<div *ngIf="isShown" class="row container-fluid" id="divshow">
14 content
15</div>