Angular 5 - Copy to clipboard

后端 未结 11 1123
旧巷少年郎
旧巷少年郎 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:01

    You can achieve this using Angular modules:

    navigator.clipboard.writeText('your text').then().catch(e => console.error(e));
    

提交回复
热议问题