2016-05-18 15:53:13 +02:00
|
|
|
// #docregion
|
2016-06-08 01:06:25 +02:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2016-05-18 15:53:13 +02:00
|
|
|
|
2016-05-24 15:16:23 +02:00
|
|
|
import { HeroArena, HeroService, Hero } from './heroes';
|
2016-05-18 15:53:13 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'toh-app',
|
|
|
|
template: '<pre>{{heroes | json}}</pre>',
|
|
|
|
providers: [HeroArena, HeroService]
|
|
|
|
})
|
2016-06-08 01:06:25 +02:00
|
|
|
export class AppComponent implements OnInit {
|
2016-05-18 15:53:13 +02:00
|
|
|
heroes: Hero[] = [];
|
|
|
|
|
|
|
|
constructor(private heroArena: HeroArena) { }
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.heroArena.getParticipants().subscribe(heroes => this.heroes = heroes);
|
|
|
|
}
|
|
|
|
}
|