Files
angular/aio/content/examples/ngmodule-faq/src/app/shared/highlight.directive.ts
2018-01-10 16:26:46 -08:00

13 lines
450 B
TypeScript

// Exact copy of contact/highlight.directive except for color and message
import { Directive, ElementRef } from '@angular/core';
@Directive({ selector: '[highlight], input' })
// Highlight the host element or any InputElement in gray
export class HighlightDirective {
constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'lightgray';
console.log(
`* Shared highlight called for ${el.nativeElement.tagName}`);
}
}