user2672420
user2672420

Reputation: 323

Display onHover icon on every treenode in Angular Material 8

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.

Upvotes: 0

Views: 206

Answers (1)

Don k Asok
Don k Asok

Reputation: 19

Best way is to write an directive

export class DisplayIconDirective {

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

}

Upvotes: 0

Related Questions