@compodoc/compodoc
Version:
The missing documentation tool for your Angular application
24 lines (18 loc) • 541 B
text/typescript
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
({
selector: '[appHighlight]',
standalone: true,
})
export class HighlightDirective {
() color = 'yellow';
constructor(private el: ElementRef) {}
('mouseenter') onMouseEnter() {
this.highlight(this.color);
}
('mouseleave') onMouseLeave() {
this.highlight('');
}
private highlight(color: string) {
this.el.nativeElement.style.backgroundColor = color;
}
}