angular/aio/content/examples/ngmodule/src/app/highlight.directive.ts
2017-03-28 10:21:46 +01:00

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}`);
}
}