Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 0f58b3e

Browse files
committed
Merge pull request #173 from thgreasi/master
docs: add suggestions and notices
2 parents 5e3d471 + 52da477 commit 0f58b3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This directive allows you to sort an array with drag & drop.
55
## Requirements
66

77
- JQuery
8-
- JQueryUI
8+
- JQueryUI (1.9+)
99
- AngularJS
1010

1111
**Notes:**
@@ -40,7 +40,7 @@ Apply the directive to your form elements:
4040
* `ui-sortable` element should only contain one `ng-repeat` and not any other elements (above or below).
4141
Otherwise the index matching of the generated DOM elements and the `ng-model`'s items will break.
4242
**In other words: The items of `ng-model` must match the indexes of the generated DOM elements.**
43-
* `ui-sortable` lists containing many 'types' of items can be implemented by using [dynamic template loading with ng-include](http://stackoverflow.com/questions/14607879/angularjs-load-dynamic-template-html-within-directive/14621927#14621927), to determine how each model item should be rendered.
43+
* `ui-sortable` lists containing many 'types' of items can be implemented by using dynamic template loading [with ng-include](http://stackoverflow.com/questions/14607879/angularjs-load-dynamic-template-html-within-directive/14621927#14621927) or a [loader directive](https://gist.github.com/thgreasi/7152499c0e91973c4820), to determine how each model item should be rendered.
4444

4545
### Options
4646

@@ -64,6 +64,9 @@ myAppModule.controller('MyController', function($scope) {
6464
</ul>
6565
```
6666

67+
When using event callbacks ([start](http://api.jqueryui.com/sortable/#event-start)/[update](http://api.jqueryui.com/sortable/#event-update)/[stop](http://api.jqueryui.com/sortable/#event-stop)...), avoid manipulating DOM elements (especially the one with the ng-repeat attached).
68+
The suggested pattern is to use callbacks for emmiting events and altering the scope (inside the 'Angular world').
69+
6770
#### Canceling
6871

6972
Inside the `update` callback, you can check the item that is dragged and cancel the sorting.

0 commit comments

Comments
 (0)