13 lines
		
	
	
		
			367 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			367 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| // #docregion
 | |
| import { Directive, ElementRef } from '@angular/core';
 | |
| 
 | |
| @Directive({ selector: '[highlight]' })
 | |
| /** Highlight the attached element in gold */
 | |
| export class HighlightDirective {
 | |
|   constructor(el: ElementRef) {
 | |
|     el.nativeElement.style.backgroundColor = 'gold';
 | |
|     console.log(
 | |
|       `* AppRoot highlight called for ${el.nativeElement.tagName}`);
 | |
|   }
 | |
| }
 |