nico-val / ngClipboard

Simple module that allows to make an HTML tag copyable on click or send a custom string to clipboard. Works on mobile!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngClipboard

AngularJS module to copy HTML tags on click, and send custom values to clipboard. No need for any Flash complements. It works on mobile devices.

##Installation

  1. Download the latest release from here.

  2. Include ngClipboard.js in your HTML.

    <script src="ngClipboard.js"></script>
  3. Inject the module in your app.

    angular.module('myApp',['ngClipboard']);

##Demo http://plnkr.co/edit/TMGDUH5IG4GazpBvT2rQ

##Usage

###ng-copyable directive Add a "ng-copyable" attribute to any html tag to make it copyable on click.

<div ng-copyable>Click to copy this text!</div>

###ngClipboard.toClipboard() factory

  1. Inject ngClipboard in your controller

    angular.controller('myController',['ngClipboard',function(ngClipboard){
      /* ... */
    }]);
  2. Then send values to clipboard using

ngClipboard.toClipboard(value);

About

Simple module that allows to make an HTML tag copyable on click or send a custom string to clipboard. Works on mobile!


Languages

Language:JavaScript 100.0%