` <button type="button" (click)="toggleVisibility()">Magic</button> <p [hidden]=“!isVisible">I will be hidden</p> <div *ngIf="isVisible">I will be removed from the DOM</div> ` }) export class AppComponent { isVisible = true; toggleVisibility() { this.isVisible = !this.isVisible; } } app.component.ts 11
` <button type="button" (click)="toggleVisibility()">Magic</button> <p [hidden]=“!isVisible">I will be hidden</p> <div *ngIf="isVisible">I will be removed from the DOM</div> ` }) export class AppComponent { isVisible = true; toggleVisibility() { this.isVisible = !this.isVisible; } } app.component.ts 12
` <button type="button" (click)="toggleVisibility()">Magic</button> <p [hidden]=“!isVisible">I will be hidden</p> <div *ngIf="isVisible">I will be removed from the DOM</div> ` }) export class AppComponent { isVisible = true; toggleVisibility() { this.isVisible = !this.isVisible; } } app.component.ts 13
` <button type="button" (click)="toggleVisibility()">Magic</button> <p [hidden]=“!isVisible">I will be hidden</p> <div *ngIf="isVisible">I will be removed from the DOM</div> ` }) export class AppComponent { isVisible = true; toggleVisibility() { this.isVisible = !this.isVisible; } } app.component.ts 14
` <button type="button" (click)="toggleVisibility()">Magic</button> <p [hidden]=“!isVisible">I will be hidden</p> <div *ngIf="isVisible">I will be removed from the DOM</div> ` }) export class AppComponent { isVisible = true; toggleVisibility() { this.isVisible = !this.isVisible; } } app.component.ts 15
DI & Local vars http://plnkr.co/edit/dawjk1EUacubwbPrJvz4 • Child components http://plnkr.co/edit/IkfBUPdxESIdDeX8jeM7 • Forms http://plnkr.co/edit/scCWNoyaCq9zMvDBNOD7 • Parent/Child (bonus) http://plnkr.co/edit/DsZUzoQz6P2BY7skhhWu 34