| 
									
										
										
										
											2016-05-18 15:53:13 +02:00
										 |  |  | import { Component, OnInit } from '@angular/core'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 15:16:23 +02:00
										 |  |  | import { Hero, HeroService } from './+heroes'; | 
					
						
							| 
									
										
										
										
											2016-05-18 15:53:13 +02:00
										 |  |  | 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 { | 
					
						
							| 
									
										
										
										
											2016-05-26 16:15:39 +02:00
										 |  |  |   favorite: Hero; | 
					
						
							| 
									
										
										
										
											2016-05-18 15:53:13 +02:00
										 |  |  |   heroes: Hero[]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor(private heroService: HeroService) { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ngOnInit() { | 
					
						
							| 
									
										
										
										
											2016-05-26 16:15:39 +02:00
										 |  |  |     this.heroService.getHero(1).subscribe(hero => this.favorite = hero); | 
					
						
							| 
									
										
										
										
											2016-05-18 15:53:13 +02:00
										 |  |  |     this.heroService.getHeroes().subscribe(heroes => this.heroes = heroes); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |