Copy to clipboard with angular material

1 · Adrian Matei · Oct. 12, 2022, 6:34 a.m.
Use the click event to pass the text to the handling function, in this case copyToClipboard(bookmark.location) <span class="btn-light btn-sm" (click)="copyToClipboard(bookmark.location)" title="Copy link to clipboard"> <i class="far fa-copy copy-link"></i><span class="copy-btn-text"></span> </span> To programmatically copy a string use the Clipboard which service copies text to the user’s clipboard. We use a setTimeout to visually inform the user for a brief moment that the copy was successfu...