2016-11-12 15:31:40 +00:00

18 lines
394 B
TypeScript

// #docregion
import { Component, Inject } from '@angular/core';
import { HeroesService } from './heroes.service';
import { Hero } from '../hero';
@Component({
selector: 'hero-detail',
template: `
<h2>{{hero.id}}: {{hero.name}}</h2>
`
})
export class HeroDetailComponent {
hero: Hero;
constructor(@Inject('heroes') heroes: HeroesService) {
this.hero = heroes.get()[0];
}
}