ngClip是一个AngularJS的扩展指令,封装了ZeroClipboard实现了拷贝到剪贴板的功能。
示例代码:
.config(['ngClipProvider', function(ngClipProvider) { ngClipProvider.setPath("bower_components/zeroclipboard/dist/ZeroClipboard.swf");}]);var myapp = angular.module('myapp', ['ngClipboard'])使用方法:
<a href="" clip-copy="getTextToCopy()" clip-click="doSomething()">Copy</a><a href="" clip-click"getHtmlToCopy()" clip-copy-mime-type="text/html">Copy HTML</a><a href="" clip-click-fallback="fallback(copy)" clip-copy="getTextToCopy()" clip-click="doSomething()">Copy</a>
评论