Angularjs directive for clipboard.js
npm install ngclipboard
npm install ngclipboard --save
`
Or bower, too.
`
bower install ngclipboard --save
`
If you're not into package management, just download a ZIP file.
Setup
First, include angularjs and clipboard.js into your document.
`html
`
Then Include ngclipboard.js.
`html
`
Add ngclipboard dependency to your module
`javascript
var myApp = angular.module('app', ['ngclipboard']);
`
Finally, add ngclipboard directive to the wanted html element.
`javascript
`
Usage
We're living a _declarative renaissance_, that's why we decided to take advantage of HTML5 data attributes for better usability.
$3
A pretty common use case is to copy content from another element. You can do that by adding a data-clipboard-target attribute in your trigger element.
The value you include on this attribute needs to match another's element selector.
`html
`
$3
Additionally, you can define a data-clipboard-action attribute to specify if you want to either copy or cut content.
If you omit this attribute, copy will be used by default.
`html
`
As you may expect, the cut action only works on or