2016-07-12 18:14:13 -07:00
|
|
|
// #docregion
|
2016-12-02 19:54:27 -05:00
|
|
|
import { Directive, ElementRef } from '@angular/core';
|
2016-07-12 18:14:13 -07:00
|
|
|
|
|
|
|
|
// Same directive name and selector as
|
|
|
|
|
// HighlightDirective in parent AppRootModule
|
|
|
|
|
// It selects for both input boxes and 'highlight' attr
|
|
|
|
|
// and it highlights in beige instead of yellow
|
|
|
|
|
@Directive({ selector: '[highlight]' })
|
|
|
|
|
export class HighlightDirective {
|
2016-12-02 19:54:27 -05:00
|
|
|
constructor(el: ElementRef) {
|
|
|
|
|
el.nativeElement.style.backgroundColor = 'beige';
|
2016-07-12 18:14:13 -07:00
|
|
|
console.log(`* Hero highlight called for ${el.nativeElement.tagName}`);
|
|
|
|
|
}
|
|
|
|
|
}
|