简体   繁体   中英

How to use Angular-Material Tooltips toggle method correctly?

I would like to click on the span element once, so that the tooltip appears and then again to hide.

Here is my html. What am I doing wrong?

<span mdTooltip="Tooltip!" (click)="tooltip.toggle()>Test</span>

Template reference variable should help you to accomplish that:

<span matTooltip="Tooltip!" #tooltip="matTooltip" (click)="tooltip.toggle()">Test</span>

See also

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM