ng-clip copy to clipboard is not working

二次信任 提交于 2019-12-04 05:30:07
Orchid

I faced the same problem; the fix is to include the js files as shown below and Run the web page on server. Create a folder in tomcat>>webapps and paste the webpage there. Now view the page at url

http://localhost:8080/(folderName)/(pageName).html
 <script src="http://asafdav.github.io/ng-csv/javascripts/ngClip.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/1.1.7/ZeroClipboard.min.js"></script>
<script>
angular.module('clip', ['ngClipboard']);

function Main($scope) {
    $scope.getTextToCopy = function() {
        return "ngClip is awesome!";
    }
    $scope.doSomething = function () {
        console.log("NgClip...");
    }
}
</script>

<html>
<body ng-app="clip" ng-controller="Main">
<h1> ngClip Example </h1>

<button type="button" clip-copy="getTextToCopy()" clip-click="doSomething()">Copy</button>
</body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!