Giter VIP home page Giter VIP logo

ng-clip's Introduction

ngClip - Copy to clipboard using AngularJS

An AngularJS simple directive that uses ZeroClipboard and updates the user's clipboard.

How to get it ?

Manual Download

Download the from here

Bower

bower install zeroclipboard ng-clip

Npm

npm install zeroclipboard ng-clip

CDN

ng-csv is available at cdnjs

Usage

  1. Add ng-clip.js and ZeroClipboard.js to your main file (index.html)

  2. Update the .swf path location using ngClipProvider

  .config(['ngClipProvider', function(ngClipProvider) {
    ngClipProvider.setPath("bower_components/zeroclipboard/dist/ZeroClipboard.swf");
  }]);
  1. Set ngClipboard as a dependency in your module
var myapp = angular.module('myapp', ['ngClipboard'])
  1. Add clip-copy directive to the wanted element, example:
<a href="" clip-copy="getTextToCopy()" clip-click="doSomething()">Copy</a>
  1. You can optionally override zeroclipboard config parameters using ngClipProvider
    ngClipProvider.setConfig({
      zIndex: 50
    });
  1. You can also optionally provide a fallback function that gets called if flash is unavailable:
<a href="" clip-click-fallback="fallback(copy)" clip-copy="getTextToCopy()" clip-click="doSomething()">Copy</a>

If the fallback function is defined to accept an argument named copy, that argument will be populated with the text to copy.

Examples

You can check out this live example here: http://plnkr.co/xwV5Yn see the examples folder for more

Bitdeli Badge

ng-clip's People

Contributors

asafdav avatar kcrwfrd avatar sampsasaarela avatar lorenzo-stoakes avatar ivanyeoh avatar bitdeli-chef avatar just-boris avatar bricejlin avatar chrisrose avatar rogeriopvl avatar urigo avatar sethflowers avatar

Watchers

Cesar Andreu avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.