1

Good morning,

Using ngx-clipboard and ng2-tooltip-directive so that i can show an icon (with tooltip being 'copy to clipboard'). This is working, now upon success (using (cbOnSuccess)) i want to change the tooltip's text from "copy to clipboard" to "copied".

<i class="fas fa-paste"
   tooltip="Copy Address to Clipboard" placement="top" 
   ngxClipboard [cbContent]="address"
   (cbOnSuccess)="copyToClipboardSuccessful()"> 
</i>

My question, is how to change the tooltip from the tag to 'copied', preferably in-line, but using a function is also fine, though will have to refer to "this" element, since it is part of a loop.

Ideally something similar to (for example) the icon besides the address on: https://bscscan.com/address/0x8c4d90829ce8f72d0163c1d5cf348a862d550630

Update:

If I use interpolation:

<i class="fas fa-paste"
   tooltip="{{message}}" placement="top" 
   ngxClipboard [cbContent]="address"
   (cbOnSuccess)="copyToClipboardSuccessful()"> 
</i>

And in my component, i change the message to "copied" in the (click) handler, the text doesn't change in real-time, it changes, when the tooltip closes and then opens again (if i hover over it), but this is not the preferred solution.

zmbq
  • 38,013
  • 14
  • 101
  • 171
Xyptilon
  • 11
  • 2

0 Answers0