1navigator.clipboard.writeText(content).then().catch(e => console.error(e));
1copyToClipboard(item): void {
2 let listener = (e: ClipboardEvent) => {
3 e.clipboardData.setData('text/plain', (item));
4 e.preventDefault();
5 };
6
7 document.addEventListener('copy', listener);
8 document.execCommand('copy');
9 document.removeEventListener('copy', listener);
10}
11