1.Include three files in web page:
ngClip.js
ZeroClipboard.js
ZeroClipboard.swf
2.Set `ngClipboard` as a dependency in your module.
var myapp = angular.module('myapp', ['ngClipboard']);
3.Update the .swf path location using ngClipProvider.
myapp.config(function ngClipProvider) {
ngClipProvider.setPath("js/ZeroClipboard.swf");
...
}
4.Add clip-copy to the wanted element like this:
<button clip-copy="head_copy()" clip-click="clip_click()">Copy to clipboard</button>
5.Set function in javascript.
<script>
function head_copy(){
return "Here is the content to be copied";
}
function clip_click(){
alert("Copy to clipboard OK!");
}
</script>