1.1.1 • Published 7 years ago

ng-copytoclipboard v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ngCopyToClipboard

An AngularJS directive to trigger a method that copy parameter

The problem

Copy text to clipboard

The solution

<input type="text" ng-model="model" ng-copy-to-clipboard="{{sometext}}" after-copy="functionAfterCopy()" required>

How to install it

Bower:

  • Run
bower install --save ng-copyToClipboard
  • HTML
<script src="bower_components/angular.js"></script>
<script src="bower_components/ng-copyToClipboard/dist/ng-copyToClipboard.min.js"></script>
  • AngularJS:
var app = angular.module('app', ['ngCopyToClipboard']);

NPM:

  • Run
npm install --save ng-copytoclipboard
  • HTML:
<script src="node_modules/angular.js"></script>
<script src="node_modules/ng-copyToClipboard/dist/ng-copyToClipboard.min.js"></script>
  • AngularJS:
var app = angular.module('app', ['ngCopyToClipboard']);

How to use it

Just add the ngCopyToClipboard attribute and a method to be called when click in html tag:

<input type="text" ng-model="model" ng-copy-to-clipboard="{{sometext}}" required>

You can also add the optional attribute after-copy to call a function after copy

<input type="text" ng-model="model" ng-copy-to-clipboard="{{sometext}}" after-copy="functionAfterCopy()" required>

License

See the LICENSE file.