apt-maintenance-account
Version:
Apartment Maintenance Account Tracking Application - Client Side in Angular
20 lines (14 loc) • 607 B
text/typescript
import { Directive, ElementRef, Input, OnChanges } from '@angular/core';
({ selector: '[highlight]' })
/** set backgroundColor for the attached element to highlight color
* and set the element's customProperty to true */
export class HighlightDirective implements OnChanges {
defaultColor = 'rgb(211, 211, 211)'; // lightgray
('highlight') bgColor: string;
constructor(private el: ElementRef) {
el.nativeElement.style.customProperty = true;
}
ngOnChanges() {
this.el.nativeElement.style.backgroundColor = this.bgColor || this.defaultColor;
}
}