Answers for "how to copy text on button click angular"

0

angular how to copy text with button

copyToClipboard(item): void {
    let listener = (e: ClipboardEvent) => {
        e.clipboardData.setData('text/plain', (item));
        e.preventDefault();
    };

    document.addEventListener('copy', listener);
    document.execCommand('copy');
    document.removeEventListener('copy', listener);
}
Posted by: Guest on January-10-2021

Code answers related to "how to copy text on button click angular"

Code answers related to "Javascript"

Browse Popular Code Answers by Language