19 lines
457 B
TypeScript
Raw Normal View History

2016-05-18 15:53:13 +02:00
import { Component, OnInit } from '@angular/core';
import { Hero, HeroCollectorService } from './core';
2016-05-18 15:53:13 +02:00
@Component({
selector: 'sg-app',
template: '<div>Our hero is {{hero.name}} and {{hero.power}}</div>',
providers: [HeroCollectorService]
})
export class AppComponent implements OnInit {
hero: Hero;
constructor(private heroCollectorService: HeroCollectorService) { }
ngOnInit() {
this.hero = this.heroCollectorService.getHero();
}
}