Skip to content

Commit 782f76c

Browse files
authored
Merge pull request #315 from chancesmith/master
cleans up readme markdown
2 parents 100e29e + 251827c commit 782f76c

File tree

1 file changed

+63
-56
lines changed

1 file changed

+63
-56
lines changed

README.md

Lines changed: 63 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,110 @@
1-
#Drag and Drop for AngularJS (with Animation)
1+
# Drag and Drop for AngularJS (with Animation)
22
[![Build Status](https://api.travis-ci.org/codef0rmer/angular-dragdrop.svg?branch=master)](https://travis-ci.org/codef0rmer/angular-dragdrop)
33
[![npm](https://img.shields.io/npm/dt/angular-dragdrop.svg)](https://www.npmjs.com/package/angular-dragdrop)
44
[![npm version](https://img.shields.io/npm/v/angular-dragdrop.svg)](https://www.npmjs.com/package/angular-dragdrop)
55
[![Bower version](https://img.shields.io/bower/v/angular-dragdrop.svg)](https://github.com/codef0rmer/angular-dragdrop)
6-
6+
77
---
88

99
Implementing jQueryUI Drag and Drop functionality in AngularJS is easier than ever with this wrapper for jQueryUI draggable/droppable components.
1010

11-
###v1.0.13
12-
1. Allow to animate back on beforeDrop-cancel event if jqyouioptions.revertDuration is set
13-
2. Pass right context in case of CtrlAs syntax
14-
3. Add vertical sortable example in demo/dnd-insertInline.html
11+
### v1.0.13
12+
13+
1. Allow to animate back on beforeDrop-cancel event if jqyouioptions.revertDuration is set
14+
1. Pass right context in case of CtrlAs syntax
15+
1. Add vertical sortable example in demo/dnd-insertInline.html
16+
17+
18+
## How to Use
1519

20+
* `bower install angular-dragdrop` (or `sudo bower install angular-dragdrop --allow-root`)
1621

17-
##How to Use
22+
* Reference `angular-dragdrop.min.js` in your application as:
1823

19-
* `bower install angular-dragdrop` (or `sudo bower install angular-dragdrop --allow-root`)
20-
* Reference `angular-dragdrop.min.js` in your application as:
2124

22-
```
25+
```
2326
<script src="components/angular-dragdrop/src/angular-dragdrop.min.js"></script>
2427
```
25-
* Resolve the dependency in the main module of your application as:
2628

27-
```
28-
angular.module('myApp', ['ngDragDrop'])
29-
```
29+
* Resolve the dependency in the main module of your application as:
30+
31+
32+
```
33+
angular.module('myApp', ['ngDragDrop'])
34+
```
35+
36+
* Drag anything as:
37+
38+
```
39+
<span data-drag="true" jqyoui-draggable>So you think you can drag</span>
40+
```
3041

31-
* Drag anything as:
42+
* Finally, check out [the cool demos](http://codef0rmer.github.io/angular-dragdrop/#/)
3243

33-
```
34-
<span data-drag="true" jqyoui-draggable>So you think you can drag</span>
35-
```
36-
* Finally, check out [the cool demos](http://codef0rmer.github.io/angular-dragdrop/#/)
37-
* Note, use [touchpunch.js](http://touchpunch.furf.com/) to enable drag/drop on touch devices.
44+
* Note, use [touchpunch.js](http://touchpunch.furf.com/) to enable drag/drop on touch devices.
3845

39-
##Angular Draggable options
46+
## Angular Draggable options
4047
* **jqyoui-draggable** – A custom angular attribute to make any element draggable. It holds more settings such as:
41-
* **index** – number – $index of an item of a model (if it is an array) associated with it
42-
* **placeholder** – boolean/string – If true, the place will be occupied even though a dragggable is moved/dropped somewhere else. If 'keep' is supplied, the original item won't be removed from the draggable.
43-
* **animate** – boolean – If true, draggable will be animated towards droppable when dropped. If multiple is not set to true on droppable then its draggable will swap its position.
44-
* **onStart** – string – callback method to be invoked (has to be defined in a controller) when dragging starts
45-
* **onStop** – string – callback method to be invoked when dragging stops
46-
* **onDrag** – string – callback method to be invoked while the mouse is moved during the dragging
47-
* **applyFilter** - string - applies AngularJS $filter on the list before swapping items. Only applicable, if ngRepeat has any filter (such as orderBy, limitTo) associated with it.
48-
* **containment** – string - position/offset. Offset by default. This forces to use jQuery.position() or jQuery.offset() to calculate proper position with respect to parent element or document respectively.
49-
* **deepCopy** - boolean (optional) – If true, makes a deep copy of draggable that looses prototypical inheritance.
50-
* **beforeDrop** – promise (optional) – Ask for confirmation before swapping. Works with both window.confirm and custom popup.
51-
* **insertInline** – boolean(optional) – Make a list sortable. Same model is mandatory for draggable and droppable.
52-
* **direction** – string(optional) – Property name that will be created on each scope to manage animation direction.
48+
* **index** – number – $index of an item of a model (if it is an array) associated with it
49+
* **placeholder** – boolean/string – If true, the place will be occupied even though a dragggable is moved/dropped somewhere else. If 'keep' is supplied, the original item won't be removed from the draggable.
50+
* **animate** – boolean – If true, draggable will be animated towards droppable when dropped. If multiple is not set to true on droppable then its draggable will swap its position.
51+
* **onStart** – string – callback method to be invoked (has to be defined in a controller) when dragging starts
52+
* **onStop** – string – callback method to be invoked when dragging stops
53+
* **onDrag** – string – callback method to be invoked while the mouse is moved during the dragging
54+
* **applyFilter** - string - applies AngularJS $filter on the list before swapping items. Only applicable, if ngRepeat has any filter (such as orderBy, limitTo) associated with it.
55+
* **containment** – string - position/offset. Offset by default. This forces to use jQuery.position() or jQuery.offset() to calculate proper position with respect to parent element or document respectively.
56+
* **deepCopy** - boolean (optional) – If true, makes a deep copy of draggable that looses prototypical inheritance.
57+
* **beforeDrop** – promise (optional) – Ask for confirmation before swapping. Works with both window.confirm and custom popup.
58+
* **insertInline** – boolean(optional) – Make a list sortable. Same model is mandatory for draggable and droppable.
59+
* **direction** – string(optional) – Property name that will be created on each scope to manage animation direction.
5360
* **data-drag** – boolean – If true, element can be draggable. Disabled otherwise.
5461
* **data-jqyoui-options** – object – should hold all the valid options supported by [jQueryUI Draggable](http://api.jqueryui.com/draggable)
5562
* **ng-model** – string – An angular model defined in a controller. Should be a JS array or object
5663

57-
##Angular Droppable options
64+
## Angular Droppable options
5865
* **jqyoui-droppable** – A custom angular attribute to make any element droppable. It holds more settings such as:
59-
* **index** – number – $index of an item of a model (if it is an array) associated with it
60-
* **multiple** – boolean – Requires to be true only if animate is set to true for draggable and to avoid swapping.
61-
* **stack** – boolean – Requires if animate is set to true on draggable and if multiple draggables positioned one below the other
62-
* **onDrop** – string – callback method to be invoked a draggable is dropped into the droppable
63-
* **onOver** – string – callback method to be invoked when an accepted draggable is dragged over the droppable
64-
* **onOut** – string – callback method to be invoked when an accepted draggable is dragged out of the droppable
65-
* **applyFilter** - string - requires if both droppable as well as draggable share the same ngModel.
66-
* **containment** – string - position/offset. Offset by default. This forces to use jQuery.position() or jQuery.offset() to calculate proper position with respect to parent element or document respectively.
67-
* **deepCopy** – boolean (optional) – If true, makes a deep copy of droppable that looses prototypical inheritance.
68-
* **beforeDrop** – promise (optional) – Ask for confirmation before dropping. Works with both window.confirm and custom popup.
66+
* **index** – number – $index of an item of a model (if it is an array) associated with it
67+
* **multiple** – boolean – Requires to be true only if animate is set to true for draggable and to avoid swapping.
68+
* **stack** – boolean – Requires if animate is set to true on draggable and if multiple draggables positioned one below the other
69+
* **onDrop** – string – callback method to be invoked a draggable is dropped into the droppable
70+
* **onOver** – string – callback method to be invoked when an accepted draggable is dragged over the droppable
71+
* **onOut** – string – callback method to be invoked when an accepted draggable is dragged out of the droppable
72+
* **applyFilter** - string - requires if both droppable as well as draggable share the same ngModel.
73+
* **containment** – string - position/offset. Offset by default. This forces to use jQuery.position() or jQuery.offset() to calculate proper position with respect to parent element or document respectively.
74+
* **deepCopy** – boolean (optional) – If true, makes a deep copy of droppable that looses prototypical inheritance.
75+
* **beforeDrop** – promise (optional) – Ask for confirmation before dropping. Works with both window.confirm and custom popup.
6976
* **data-drop** – boolean – If true, element can be droppable. Disabled otherwise.
7077
* **data-jqyoui-options** – object – should hold all the valid options supported by [jQueryUI Droppable](http://api.jqueryui.com/droppable)
7178
* **ng-model** – string – An angular model defined in a controller. Should be a JS array or object.
7279

73-
##How to Contribute
80+
## How to Contribute
7481
* $ git clone https://github.com/codef0rmer/angular-dragdrop.git
7582
* $ cd angular-dragdrop
7683
* $ npm install --quiet -g karma-cli bower
7784
* $ sudo npm install
7885
* $ sudo bower install --force-latest
7986
* $ npm test
8087

81-
##Demo
88+
## Demo
8289
Demo is [here](http://codef0rmer.github.io/angular-dragdrop/#/)
8390

84-
###v1.0.12
85-
1. Supports insertInline option to simulate sortable functionality.
86-
2. Relies on ngAnimate for sortable animation from left/right.
87-
3. Checkout the demo in demo/dnd-insertInline.html
91+
### v1.0.12
92+
1. Supports insertInline option to simulate sortable functionality.
93+
1. Relies on ngAnimate for sortable animation from left/right.
94+
1. Checkout the demo in demo/dnd-insertInline.html
8895

89-
###v1.0.9 - breaking change
90-
1. Draggable and Droppable will not be [deep copied](https://egghead.io/lessons/angularjs-angular-copy-for-deep-copy) by default unlike previous versions. Use `deepCopy` option if prototypical inheritance is not required.
91-
2. Callbacks will not be executed forcefully within the context of scope which requires an extra digest loop for each event (start, stop, over, out, etc), especially drag that fires many times and running a digest loop is performance intensive in such scenario. Call `scope.$apply()` within callback, if needed.
96+
### v1.0.9 - breaking change
97+
1. Draggable and Droppable will not be [deep copied](https://egghead.io/lessons/angularjs-angular-copy-for-deep-copy) by default unlike previous versions. Use `deepCopy` option if prototypical inheritance is not required.
98+
1. Callbacks will not be executed forcefully within the context of scope which requires an extra digest loop for each event (start, stop, over, out, etc), especially drag that fires many times and running a digest loop is performance intensive in such scenario. Call `scope.$apply()` within callback, if needed.
9299

93100

94-
###v1.0.5 - breaking change
101+
### v1.0.5 - breaking change
95102
Do not pass evaluated expressions in callbacks. For example,
96-
####Before:
103+
#### Before:
97104
```
98105
<div jqyoui-draggable="{onStart:'startCallback({{item}})'}">{{item.title}}</div>
99106
```
100-
####After:
107+
#### After:
101108
```
102109
<div jqyoui-draggable="{onStart:'startCallback(item)'}">{{item.title}}</div>
103110
```

0 commit comments

Comments
 (0)