ngClip - Copy to clipboard using AngularJS
An AngularJS simple directive that uses ZeroClipboard and updates the user's clipboard.
How to get it ?
Manual Download
Download the from here
Bower
bower install zeroclipboard ng-clip
Npm
npm install zeroclipboard ng-clip
CDN
ng-clip is available at cdnjs
Usage
-
Add ng-clip.js and ZeroClipboard.js to your main file (index.html)
-
Update the .swf path location using ngClipProvider
;
- Set
ngClipboard
as a dependency in your module
var myapp = angular
- Add clip-copy directive to the wanted element, example:
Copy
- You can optionally override zeroclipboard config parameters using ngClipProvider
ngClipProvider;
- You can optionally specify the MIME type by providing using the
clip-copy-mime-type
attribute:
Copy HTML
- You can also optionally provide a fallback function that gets called if flash is unavailable:
Copy
If the fallback function is defined to accept an argument named copy
, that argument will be populated with the text to copy.
Examples
You can check out this live example here: http://plnkr.co/xwV5Yn see the examples folder for more