20 lines
		
	
	
		
			331 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			20 lines
		
	
	
		
			331 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | // #docplaster
 | ||
|  | // #docregion
 | ||
|  | import {Component, OnInit} | ||
|  |   from 'angular2/core'; | ||
|  |   // #enddocregion
 | ||
|  | 
 | ||
|  | @Component({ | ||
|  |   selector: 'hero-lifecycle', | ||
|  |   template: `<h1>Hero: {{name}}</h1>` | ||
|  | }) | ||
|  | // #docregion
 | ||
|  | export class HeroComponent | ||
|  |     implements OnInit { | ||
|  |   name:string; | ||
|  |   ngOnInit() { | ||
|  |     this.name = 'Windstorm'; | ||
|  |   } | ||
|  | } | ||
|  | // #enddocregion
 |