| 
									
										
										
										
											2016-04-27 11:28:22 -07:00
										 |  |  | import {Component, HostBinding, HostListener} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'heroes-bindings', | 
					
						
							|  |  |  |   template: `<h1 [class.active]="active">
 | 
					
						
							|  |  |  |     Tour of Heroes | 
					
						
							|  |  |  |   </h1>`
 | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class HeroesComponent { | 
					
						
							|  |  |  |   @HostBinding() title = 'Tooltip content'; | 
					
						
							|  |  |  |   @HostBinding('class.heading') | 
					
						
							|  |  |  |     hClass = true | 
					
						
							|  |  |  |   active:boolean; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   constructor() {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @HostListener('click') | 
					
						
							|  |  |  |   clicked() { | 
					
						
							|  |  |  |     this.active = !this.active; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @HostListener('dblclick', ['$event']) | 
					
						
							|  |  |  |   doubleClicked(evt:Event) { | 
					
						
							|  |  |  |     this.active = true; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion
 |