Answers for "angular how to copy text with button"

5

copy to clipboard angular

navigator.clipboard.writeText(content).then().catch(e => console.error(e));
Posted by: Guest on November-24-2020
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 "angular how to copy text with button"

Code answers related to "Javascript"

Browse Popular Code Answers by Language