| 
									
										
										
										
											2016-04-11 15:36:53 +03:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-11-12 15:27:51 +00:00
										 |  |  | // #docregion hero-detail-io
 | 
					
						
							| 
									
										
										
										
											2016-04-11 15:36:53 +03:00
										 |  |  | export const heroDetail = { | 
					
						
							|  |  |  |   bindings: { | 
					
						
							| 
									
										
										
										
											2016-04-25 12:09:37 +03:00
										 |  |  |     hero: '<', | 
					
						
							| 
									
										
										
										
											2016-04-11 15:36:53 +03:00
										 |  |  |     deleted: '&' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   template: `
 | 
					
						
							|  |  |  |     <h2>{{$ctrl.hero.name}} details!</h2> | 
					
						
							|  |  |  |     <div><label>id: </label>{{$ctrl.hero.id}}</div> | 
					
						
							|  |  |  |     <button ng-click="$ctrl.onDelete()">Delete</button> | 
					
						
							|  |  |  |   `,
 | 
					
						
							|  |  |  |   controller: function() { | 
					
						
							|  |  |  |     this.onDelete = () => { | 
					
						
							|  |  |  |       this.deleted(this.hero); | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2016-11-12 15:27:51 +00:00
										 |  |  | // #enddocregion hero-detail-io
 | 
					
						
							| 
									
										
										
										
											2016-11-10 12:04:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-12 15:27:51 +00:00
										 |  |  | // #docregion hero-detail-io-upgrade
 | 
					
						
							| 
									
										
										
										
											2016-11-10 12:04:19 +00:00
										 |  |  | import { Directive, ElementRef, Injector, Input, Output, EventEmitter } from '@angular/core'; | 
					
						
							|  |  |  | import { UpgradeComponent } from '@angular/upgrade/static'; | 
					
						
							|  |  |  | import { Hero } from '../hero'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Directive({ | 
					
						
							|  |  |  |   selector: 'hero-detail' | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2016-11-10 15:27:45 +00:00
										 |  |  | export class HeroDetailDirective extends UpgradeComponent { | 
					
						
							| 
									
										
										
										
											2016-11-10 12:04:19 +00:00
										 |  |  |   @Input() hero: Hero; | 
					
						
							|  |  |  |   @Output() deleted: EventEmitter<Hero>; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor(elementRef: ElementRef, injector: Injector) { | 
					
						
							|  |  |  |     super('heroDetail', elementRef, injector); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-11-12 15:27:51 +00:00
										 |  |  | // #enddocregion hero-detail-io-upgrade
 |