mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-23 17:59:12 +00:00
22 lines
631 B
TypeScript
22 lines
631 B
TypeScript
import { Directive, ElementRef, HostListener, Input, Renderer } from '@angular/core';
|
|
|
|
@Directive({
|
|
selector: '[feedHighlight]'
|
|
})
|
|
export class HighlightDirective {
|
|
constructor(private el: ElementRef, private renderer: Renderer) {
|
|
this.renderer.setElementClass(this.el.nativeElement, 'feed-highlight', true);
|
|
}
|
|
|
|
@HostListener('mouseenter') onMouseEnter() {
|
|
this.highlight('white');
|
|
}
|
|
|
|
@HostListener('mouseleave') onMouseLeave() {
|
|
this.highlight(null);
|
|
}
|
|
|
|
private highlight(color: string) {
|
|
this.renderer.setElementStyle(this.el.nativeElement, 'backgroundColor', color);
|
|
}
|
|
} |