Angular 5 - Copy to clipboard

后端 未结 11 1113
旧巷少年郎
旧巷少年郎 2020-11-30 18:26

I am trying to implement an icon that when clicked will save a variable to the user\'s clipboard. I have currently tried several libraries and none of them have been able to

11条回答
  •  再見小時候
    2020-11-30 19:15

    Use navigator.clipboard.writeText to copy the content to clipboard

    navigator.clipboard.writeText(content).then().catch(e => console.error(e));
    

提交回复
热议问题