Skip to content

toedio/ng-copyToClipboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Directive copy to clipboard

Resources

License

Stars

Watchers

Forks

Packages

No packages published