| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | import { | 
					
						
							|  |  |  |   Component, | 
					
						
							|  |  |  |   HostBinding, | 
					
						
							|  |  |  |   HostListener, | 
					
						
							|  |  |  |   NgModule | 
					
						
							|  |  |  | } from '@angular/core'; | 
					
						
							|  |  |  | import { BrowserModule } from '@angular/platform-browser'; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | // #docregion
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'heroes-bindings', | 
					
						
							|  |  |  |   template: `<h1 [class.active]="active">
 | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  |     Tour of Heroes | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |   </h1>`
 | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | class HeroesComponent { | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |   @HostBinding() title = 'Tooltip content'; | 
					
						
							|  |  |  |   @HostBinding('class.heading') | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |     hClass = true; | 
					
						
							|  |  |  |   active: boolean; | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   constructor() {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @HostListener('click') | 
					
						
							|  |  |  |   clicked() { | 
					
						
							|  |  |  |     this.active = !this.active; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @HostListener('dblclick', ['$event']) | 
					
						
							| 
									
										
										
										
											2016-06-08 01:06:25 +02:00
										 |  |  |   doubleClicked(evt: Event) { | 
					
						
							| 
									
										
										
										
											2016-03-16 18:01:33 +02:00
										 |  |  |     this.active = true; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | // #enddocregion
 | 
					
						
							| 
									
										
										
										
											2016-08-09 17:38:25 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | @NgModule({ | 
					
						
							|  |  |  |   imports: [ BrowserModule ], | 
					
						
							|  |  |  |   declarations: [ HeroesComponent ], | 
					
						
							|  |  |  |   bootstrap: [ HeroesComponent ] | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class HeroesHostBindingsModule { } |