mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 17:27:48 +00:00
fix highlight directive
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="chat-table">
|
||||
<table class="table table-striped">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div class="feed-table">
|
||||
<table class="table table-striped">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
@@ -5,17 +5,14 @@ import { Directive, ElementRef, HostListener, Input, Renderer } from '@angular/c
|
||||
})
|
||||
export class HighlightDirective {
|
||||
constructor(private el: ElementRef, private renderer: Renderer) {
|
||||
this.renderer.setElementClass(this.el.nativeElement, 'feed-highlight', true);
|
||||
let self = this;
|
||||
self.renderer.setElementClass(this.el.nativeElement, 'feed-highlight', true);
|
||||
setTimeout(function() {
|
||||
console.log('removing..');
|
||||
self.renderer.setElementClass(self.el.nativeElement,'feed-highlight-light', true);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@HostListener('mouseenter') onMouseEnter() {
|
||||
this.highlight('white');
|
||||
}
|
||||
|
||||
@HostListener('mouseleave') onMouseLeave() {
|
||||
this.highlight(null);
|
||||
}
|
||||
|
||||
private highlight(color: string) {
|
||||
this.renderer.setElementStyle(this.el.nativeElement, 'backgroundColor', color);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user