angular-cn/public/docs/_examples/ngmodule/ts/app/shared/highlight.directive.ts

14 lines
530 B
TypeScript
Raw Normal View History

2016-07-12 18:14:13 -07:00
/* 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}`);
}
}