2

Is there any way to display all the tooltips at the same time in angular matTooltip. We can do this like below, but it needs to declare all the viewChild for doing that,

@ViewChild('tooltip', { static: true })tooltip:MatTooltip;

There are more than 50 mat-tooltip elements in the app. Is there are any easy way to do that in angular.

nipun-kavishka
  • 842
  • 12
  • 21

1 Answers1

0

There's ViewChildren

Something like

@ViewChildren(MatToolTip) tooltips: QueryList<MatTooltip>;

showAll(): void {
  this.tooltips.forEach(toolTip => toolTip.show())
}

StackBlitz example

Stav Noy
  • 419
  • 4
  • 14