| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | import { Component, NgModule } from '@angular/core'; | 
					
						
							|  |  |  | import { BrowserModule } from '@angular/platform-browser'; | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | import { DataService } from './data.service'; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'hero-di', | 
					
						
							|  |  |  |   template: `<h1>Hero: {{name}}</h1>` | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | class HeroComponent { | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   name: string; | 
					
						
							|  |  |  |   constructor(dataService: DataService) { | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |     this.name = dataService.getHeroName(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion
 | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @NgModule({ | 
					
						
							|  |  |  |   imports: [ BrowserModule ], | 
					
						
							|  |  |  |   providers: [ DataService ], | 
					
						
							|  |  |  |   declarations: [ HeroComponent ], | 
					
						
							|  |  |  |   bootstrap: [ HeroComponent ] | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class HeroesDIModule { } |