I have an Angular 6 application that displays a grid of objects of different type. I'd like that, when a user moves the mouse over an object for a while (300ms for example), a tooltip appeared with more information about that object. I'm using PrimeNG UI library, that comes with a handy tooltip component, that can be used like this:
<div class="divObject"
pTooltip="<h2>Object info</h2><p>Here would go the object information</p>" [escape]="false"
tooltipPosition="top">
<!-- OBJECT NAME -->
</div>
The problem I have is that, to get the info about the object, I need to make a call to the DB server. So, I considered creating a pipe to get the data, and use it like:
<div class="divObject"
pTooltip="{{ object | getInfoPipe }}" [escape]="false"
tooltipPosition="top">
<!-- OBJECT NAME -->
</div>
But, I've read that using pipes for API calls is a really bad idea because it can be called tens of times, so it would overload the server rapidly.
How could I achieve what I need? (Not necessarily using the PrimeNG tooltip component, I'm open to other alternatives)
Thanks!