angular-cn/public/docs/_examples/ngmodule/ts/app/shared/highlight.directive.ts
2016-08-09 12:31:52 -07:00

14 lines
530 B
TypeScript

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