how to get clipboard data in angular JS

后端 未结 5 2008
温柔的废话
温柔的废话 2020-12-10 13:14

I was actually looking to get the content of clipboard using angular JS to simulate a copy paste thing.

5条回答
  •  醉酒成梦
    2020-12-10 13:37

    I created a directive for copy to clipboard which is using the document.execCommand() method.

    Directive

    (function() {
    app.directive('copyToClipboard',  function ($window) {
            var body = angular.element($window.document.body);
            var textarea = angular.element('