* Removed 03-05, 04-12, 04-15. Removed style for whitespace in imports. Removed + sign prefix for routing folders. Updated all code. Removed style that said to use lazy loading. There was no value in the style other than use it :) * renamed componet router to router
23 lines
653 B
TypeScript
23 lines
653 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
|
|
import { Hero, HeroService } from './heroes';
|
|
import { ExceptionService, SpinnerService, ToastService } from './shared';
|
|
|
|
@Component({
|
|
moduleId: module.id,
|
|
selector: 'sg-app',
|
|
templateUrl: 'app.component.html',
|
|
providers: [HeroService, ExceptionService, SpinnerService, ToastService]
|
|
})
|
|
export class AppComponent implements OnInit {
|
|
favorite: Hero;
|
|
heroes: Hero[];
|
|
|
|
constructor(private heroService: HeroService) { }
|
|
|
|
ngOnInit() {
|
|
this.heroService.getHero(1).subscribe(hero => this.favorite = hero);
|
|
this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes);
|
|
}
|
|
}
|