Display onHover icon on every treenode in Angular Material 8

177 Views Asked by At

I am having requirement to display icon on Hover on every treenode in Angular Material 8.

What is the best way to achieve this?

Considering we will be having 500-1000 treenodes and performance aspects, I do not want to achieve this using ngAfterViewChecked and bind onHover event on each treeNode.

1

There are 1 best solutions below

0
Don k Asok On

Best way is to write an directive

export class DisplayIconDirective {

  @HostBinding('width') width = 0
  @HostListener('mouseenter',['$event'])
  onHover(e){
    this.width = 200
  }

}