| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | // #docplaster
 | 
					
						
							|  |  |  | (function(app) { | 
					
						
							| 
									
										
										
										
											2016-11-13 14:09:28 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							|  |  |  | app.HeroLifecycleComponent = HeroComponent; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HeroComponent.annotations = [ | 
					
						
							|  |  |  |   new ng.core.Component({ | 
					
						
							|  |  |  |     selector: 'hero-lifecycle', | 
					
						
							|  |  |  |     template: '<h1>Hero: {{name}}</h1>' | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function HeroComponent() { } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HeroComponent.prototype.ngOnInit = function() { | 
					
						
							|  |  |  |   // todo: fetch from server async
 | 
					
						
							|  |  |  |   setTimeout(() => this.name = 'Windstorm', 0); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | // #enddocregion
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | })(window.app = window.app || {}); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /////// DSL version ////
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | (function(app) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion dsl
 | 
					
						
							|  |  |  | app.HeroLifecycleDslComponent = ng.core.Component({ | 
					
						
							|  |  |  |     selector: 'hero-lifecycle-dsl', | 
					
						
							|  |  |  |     template: '<h1>Hero: {{name}}</h1>' | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  |   .Class({ | 
					
						
							|  |  |  |     constructor: function HeroLifecycleDslComponent() { }, | 
					
						
							|  |  |  |     ngOnInit: function() { | 
					
						
							|  |  |  |       // todo: fetch from server async
 | 
					
						
							|  |  |  |       setTimeout(() => this.name = 'Windstorm', 0); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | // #enddocregion dsl
 | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | })(window.app = window.app || {}); |