'How to use COMMON API in a tooltip?
according to the docs:
https://ng.ant.design/components/tooltip/en#common-api
There are three methods, hide, show and updatePosition. How do i use them? i tried to ViewChild the component with the nz-tooltip, and applying the .hide() on that, but no luck. How can i target an specific nz-tooltip?
Thanks!
Solution 1:[1]
In this case the common API is exposed by the tooltip directive. You can grab it by using a template variable referencing the directive:
#tooltip="nzTooltip"
this way you can use "tooltip" to call the API method you desire, either in the template directly
<button (click)="tooltip.show()">Show</button>
or recalling the template variable in the component's typescript using viewChild.
Working stackblitz: https://stackblitz.com/edit/angular-jpp37y
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alessandro Pace |
