| 
									
										
										
										
											2016-07-12 18:14:13 -07:00
										 |  |  | // #docregion
 | 
					
						
							| 
									
										
										
										
											2016-12-02 19:54:27 -05:00
										 |  |  | import { Directive, ElementRef } from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-07-12 18:14:13 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | @Directive({ selector: '[highlight]' }) | 
					
						
							|  |  |  | /** Highlight the attached element in gold */ | 
					
						
							|  |  |  | export class HighlightDirective { | 
					
						
							| 
									
										
										
										
											2016-12-02 19:54:27 -05:00
										 |  |  |   constructor(el: ElementRef) { | 
					
						
							|  |  |  |     el.nativeElement.style.backgroundColor = 'gold'; | 
					
						
							| 
									
										
										
										
											2016-07-12 18:14:13 -07:00
										 |  |  |     console.log( | 
					
						
							|  |  |  |       `* AppRoot highlight called for ${el.nativeElement.tagName}`); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |