| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | // #docplaster
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  | import { Component }         from '@angular/core'; | 
					
						
							|  |  |  | import { HTTP_PROVIDERS }    from '@angular/http'; | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | import { HeroListComponent } from './hero-list.component'; | 
					
						
							|  |  |  | import { HeroService }       from './hero.service'; | 
					
						
							|  |  |  | // #enddocregion
 | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | // #docregion in-mem-web-api-imports
 | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  | import { provide }           from '@angular/core'; | 
					
						
							|  |  |  | import { XHRBackend }        from '@angular/http'; | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | // in-memory web api imports
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | import { InMemoryBackendService, | 
					
						
							| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  |         SEED_DATA }          from 'angular2-in-memory-web-api/core'; | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | import { HeroData }          from '../hero-data'; | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | // #enddocregion in-mem-web-api-imports
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'my-toh', | 
					
						
							|  |  |  | // #docregion template
 | 
					
						
							|  |  |  |   template: `
 | 
					
						
							|  |  |  |   <h1>Tour of Heroes</h1> | 
					
						
							|  |  |  |   <hero-list></hero-list> | 
					
						
							|  |  |  |   `,
 | 
					
						
							|  |  |  |   // #enddocregion template
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  |   directives: [HeroListComponent], | 
					
						
							|  |  |  |   providers:  [ | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  |     HTTP_PROVIDERS, | 
					
						
							|  |  |  |     HeroService, | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | // #enddocregion
 | 
					
						
							|  |  |  | // #docregion in-mem-web-api-providers
 | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  |     // in-memory web api providers
 | 
					
						
							|  |  |  |     provide(XHRBackend, { useClass: InMemoryBackendService }), // in-mem server
 | 
					
						
							|  |  |  |     provide(SEED_DATA,  { useClass: HeroData }) // in-mem server data
 | 
					
						
							| 
									
										
										
										
											2016-04-13 08:21:32 -07:00
										 |  |  | // #enddocregion in-mem-web-api-providers
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2015-12-01 12:15:14 +01:00
										 |  |  |   ] | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class TohComponent { } | 
					
						
							|  |  |  | // #enddocregion
 |