|
1 |
| -/* tslint:disable:member-ordering */ |
2 |
| -import { Component } from '@angular/core'; |
3 |
| -import { Observable } from 'rxjs/Observable'; |
4 |
| - |
5 |
| -import { Hero } from './data-model'; |
6 |
| -import { HeroService } from './hero.service'; |
7 |
| - |
8 |
| -@Component({ |
9 |
| - moduleId: module.id, |
10 |
| - selector: 'my-app', |
11 |
| - templateUrl: 'demo.component.html' |
12 |
| -}) |
13 |
| -export class DemoComponent { |
14 |
| - |
15 |
| - demos: string[] = [ |
16 |
| - 'Just a FormControl', |
17 |
| - 'FormControl in a FormGroup', |
18 |
| - 'Simple FormBuilder group', |
19 |
| - 'Group with multiple controls', |
20 |
| - 'Nested FormBuilder group', |
21 |
| - 'PatchValue', |
22 |
| - 'SetValue', |
23 |
| - 'FormArray', |
24 |
| - 'Final'].map(n => n + ' Demo'); |
25 |
| - |
26 |
| - final = this.demos.length; |
27 |
| - demo = this.final; // current demo |
28 |
| - |
29 |
| - heroes: Observable<Hero[]>; |
30 |
| - isLoading = false; |
31 |
| - selectedHero: Hero; |
32 |
| - |
33 |
| - constructor(private heroService: HeroService) { } |
34 |
| - |
35 |
| - getHeroes() { |
36 |
| - this.isLoading = true; |
37 |
| - this.heroes = this.heroService.getHeroes() |
38 |
| - .finally(() => this.isLoading = false); |
39 |
| - this.selectedHero = undefined; |
40 |
| - } |
41 |
| - |
42 |
| - select(hero: Hero) { this.selectedHero = hero; } |
43 |
| - |
44 |
| - selectDemo(demo: number) { |
45 |
| - this.demo = demo + 1; |
46 |
| - this.getHeroes(); |
47 |
| - } |
48 |
| -} |
| 1 | +/* tslint:disable:member-ordering */ |
| 2 | +import { Component } from '@angular/core'; |
| 3 | +import { Observable } from 'rxjs/Observable'; |
| 4 | + |
| 5 | +import { Hero } from './data-model'; |
| 6 | +import { HeroService } from './hero.service'; |
| 7 | + |
| 8 | +@Component({ |
| 9 | + moduleId: module.id, |
| 10 | + selector: 'my-app', |
| 11 | + templateUrl: 'demo.component.html' |
| 12 | +}) |
| 13 | +export class DemoComponent { |
| 14 | + |
| 15 | + demos: string[] = [ |
| 16 | + 'Just a FormControl', |
| 17 | + 'FormControl in a FormGroup', |
| 18 | + 'Simple FormBuilder group', |
| 19 | + 'Group with multiple controls', |
| 20 | + 'Nested FormBuilder group', |
| 21 | + 'PatchValue', |
| 22 | + 'SetValue', |
| 23 | + 'FormArray', |
| 24 | + 'Final'].map(n => n + ' Demo'); |
| 25 | + |
| 26 | + final = this.demos.length; |
| 27 | + demo = this.final; // current demo |
| 28 | + |
| 29 | + heroes: Observable<Hero[]>; |
| 30 | + isLoading = false; |
| 31 | + selectedHero: Hero; |
| 32 | + |
| 33 | + constructor(private heroService: HeroService) { } |
| 34 | + |
| 35 | + getHeroes() { |
| 36 | + this.isLoading = true; |
| 37 | + this.heroes = this.heroService.getHeroes() |
| 38 | + .finally(() => this.isLoading = false); |
| 39 | + this.selectedHero = undefined; |
| 40 | + } |
| 41 | + |
| 42 | + select(hero: Hero) { this.selectedHero = hero; } |
| 43 | + |
| 44 | + selectDemo(demo: number) { |
| 45 | + this.demo = demo + 1; |
| 46 | + this.getHeroes(); |
| 47 | + } |
| 48 | +} |
0 commit comments