| 
									
										
										
										
											2016-06-13 00:41:33 +02:00
										 |  |  | /* tslint:disable:no-unused-variable */ | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-12-02 19:54:27 -05:00
										 |  |  | import { Directive, ElementRef, HostListener, Input } from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Directive({ | 
					
						
							| 
									
										
										
										
											2016-06-13 00:41:33 +02:00
										 |  |  |   selector: '[myHighlight]' | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-16 19:38:07 -08:00
										 |  |  | export class HighlightDirective { | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  |   // #docregion ctor
 | 
					
						
							| 
									
										
										
										
											2016-12-02 19:54:27 -05:00
										 |  |  |   constructor(private el: ElementRef) { } | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  |   // #enddocregion ctor
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-13 00:41:33 +02:00
										 |  |  |   // #docregion mouse-methods, host
 | 
					
						
							|  |  |  |   @HostListener('mouseenter') onMouseEnter() { | 
					
						
							|  |  |  |     // #enddocregion host
 | 
					
						
							|  |  |  |     this.highlight('yellow'); | 
					
						
							|  |  |  |     // #docregion host
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @HostListener('mouseleave') onMouseLeave() { | 
					
						
							|  |  |  |     // #enddocregion host
 | 
					
						
							|  |  |  |     this.highlight(null); | 
					
						
							|  |  |  |     // #docregion host
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   // #enddocregion host
 | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  |   private highlight(color: string) { | 
					
						
							| 
									
										
										
										
											2016-12-02 19:54:27 -05:00
										 |  |  |     this.el.nativeElement.style.backgroundColor = 'yellow'; | 
					
						
							| 
									
										
										
										
											2015-11-19 16:59:22 -08:00
										 |  |  |   } | 
					
						
							|  |  |  |   // #enddocregion mouse-methods
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2016-05-03 14:06:32 +02:00
										 |  |  | // #enddocregion
 |