ngClip 详细介绍
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>