An AngularJS directive to trigger a method that copy parameter
Copy text to clipboard
<input type="text" ng-model="model" ng-copy-to-clipboard="{{sometext}}" after-copy="functionAfterCopy()" required>- 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']);- 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']);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>See the LICENSE file.