2017-02-22 18:13:21 +00:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
|
|
|
@Component({
|
2017-08-22 21:31:15 +02:00
|
|
|
selector: 'app-root',
|
2017-02-22 18:13:21 +00:00
|
|
|
template: `
|
|
|
|
<label><input type="checkbox" [checked]="showHeroes" (change)="showHeroes=!showHeroes">Heroes</label>
|
|
|
|
<label><input type="checkbox" [checked]="showVillains" (change)="showVillains=!showVillains">Villains</label>
|
|
|
|
<label><input type="checkbox" [checked]="showCars" (change)="showCars=!showCars">Cars</label>
|
|
|
|
|
|
|
|
<h1>Hierarchical Dependency Injection</h1>
|
|
|
|
|
2017-08-22 21:31:15 +02:00
|
|
|
<app-heroes-list *ngIf="showHeroes"></app-heroes-list>
|
|
|
|
<app-villains-list *ngIf="showVillains"></app-villains-list>
|
|
|
|
<app-cars *ngIf="showCars"></app-cars>
|
2017-02-22 18:13:21 +00:00
|
|
|
`
|
|
|
|
})
|
|
|
|
export class AppComponent {
|
|
|
|
showCars = true;
|
|
|
|
showHeroes = true;
|
|
|
|
showVillains = true;
|
|
|
|
}
|