| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | import { Component, OnInit } from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'hero-lifecycle', | 
					
						
							|  |  |  |   template: `<h1>Hero: {{name}}</h1>` | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2016-11-13 14:09:28 -08:00
										 |  |  | export class HeroComponent implements OnInit { | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   name: string; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |   ngOnInit() { | 
					
						
							| 
									
										
										
										
											2016-11-13 14:09:28 -08:00
										 |  |  |     // todo: fetch from server async
 | 
					
						
							|  |  |  |     setTimeout(() => this.name = 'Windstorm', 0); | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | } |