From 78bbdf098a37586c6899f3c36d739dc13c628133 Mon Sep 17 00:00:00 2001 From: Sachin Date: Wed, 21 Oct 2015 22:46:18 +0530 Subject: [PATCH] Readme updates.. --- README.md | 218 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 134 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 3b9e5ae..2944265 100644 --- a/README.md +++ b/README.md @@ -1,108 +1,158 @@ -![license](https://img.shields.io/npm/l/ladda-angular.svg) -![travis](https://travis-ci.org/sachinchoolur/ladda-angular.svg?branch=master) -![bower](https://img.shields.io/bower/v/ladda-angular.svg) -![npm](https://img.shields.io/npm/v/ladda-angular.svg) +# ngclipboard -# ladda-angular -Angularjs directive for [Ladda](http://lab.hakim.se/ladda/) button *`( <300 bytes )`* by [@hakimel](https://twitter.com/hakimel) +![license](https://img.shields.io/npm/l/ngclipboard.svg) +![travis](https://travis-ci.org/sachinchoolur/ngclipboard.svg?branch=master) +![bower](https://img.shields.io/bower/v/ngclipboard.svg) +![npm](https://img.shields.io/npm/v/ngclipboard.svg) -Demo ---- -[Ladda angular](http://sachinchoolur.github.io/ladda-angular/) +> Angularjs directive for clipboard.js -You can also check live demo on [codepen](http://codepen.io/sachinchoolur/pen/ogxpOZ) +## Install -How to use ---- -#### Bower +You can get it on npm. -You can Install ladda-angular using the [Bower](http://bower.io) package manager. +``` +npm install ngclipboard --save +``` + +Or bower, too. -```sh -$ bower install ladda-angular --save ``` +bower install ngclipboard --save +``` + +If you're not into package management, just [download a ZIP](https://github.com/sachinchoolur/ngclipboard/archive/master.zip) file. + +## Setup + +First, include angularjs and clipboard.js into your document. + +```html + + +``` + +Then Include ngclipboard.js. + +```html + +``` +Add `ngclipboard` dependency to your module +```javascript +var myApp = angular.module('app', ['ngclipboard']); +``` + +Finally, add `ngclipboard` directive to the wanted html element. + +```javascript + +``` + +# Usage + +We're living a _declarative renaissance_, that's why we decided to take advantage of [HTML5 data attributes](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes) for better usability. + +### Copy text from another element + +A pretty common use case is to copy content from another element. You can do that by adding a `data-clipboard-target` attribute in your trigger element. + +The value you include on this attribute needs to match another's element selector. -#### npm +example-2 -You can also find ladda-angular on [npm](http://npmjs.org). +```html + + -```sh -$ npm install ladda-angular + + ``` -#### Create your ladda button -For more information about how to create ladda button please refer [ladda](https://github.com/hakimel/Ladda) button repository. +### Cut text from another element -#### The code -add the Following code into your document. -``` html - +Additionally, you can define a `data-clipboard-action` attribute to specify if you want to either `copy` or `cut` content. + +If you omit this attribute, `copy` will be used by default. + +example-3 + +```html + + + + + ``` -#### module -Add `ladda` dependency to your module -``` javascript -var myApp = angular.module("app", ["ladda"]); + +As you may expect, the `cut` action only works on `` or `