Skip to content

Commit 56e97c3

Browse files
authored
Update README.md
1 parent 3693e09 commit 56e97c3

File tree

1 file changed

+41
-36
lines changed

1 file changed

+41
-36
lines changed

README.md

+41-36
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,67 @@ Angular 1 module that integrates with Sortable.js
66
# Installation
77

88
## Install with NPM
9-
npm install angular-legacy-sortablejs
9+
10+
npm install angular-legacy-sortablejs
11+
1012

1113
# Examples
1214

1315
## Simple Drag and Drop
14-
```
16+
17+
```js
1518
angular.module('exampleApp', [])
16-
.component('dragAndDropExample', {
17-
template: `<ul ng-sortable>
18-
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']">
19-
{$ item $}
20-
</li>
21-
</ul>`,
22-
})
19+
.component('dragAndDropExample', {
20+
template: `<ul ng-sortable>
21+
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']">
22+
{$ item $}
23+
</li>
24+
</ul>`,
25+
})
2326
```
2427

2528
## Specifying a Config
2629
You can pass a Config obj to `ng-sortable` and it will pass this onto the created sortable object. The available options can be found [here](https://github.com/RubaXa/Sortable#options)
27-
```
30+
31+
```js
2832
angular.module('exampleApp', [])
29-
.component('dragAndDropExample', {
30-
template: `<ul ng-sortable=$ctrl.sortableConf>
31-
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']">
32-
{$ item $}
33-
</li>
34-
</ul>`,
35-
controller: function AppSidebarController() {
36-
var ctrl = this;
37-
ctrl.sortableConf = {
33+
.component('dragAndDropExample', {
34+
template: `<ul ng-sortable=$ctrl.sortableConf>
35+
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']">
36+
{$ item $}
37+
</li>
38+
</ul>`,
39+
controller: function AppSidebarController() {
40+
var ctrl = this;
41+
ctrl.sortableConf = {
3842
animation: 350,
3943
chosenClass: 'sortable-chosen',
4044
forceFallback: true,
41-
};
42-
},
43-
})
45+
};
46+
},
47+
});
4448
```
4549

4650
# Drag handle
4751
Example showing how use the handle option
48-
```
52+
53+
```js
4954
angular.module('exampleApp', [])
50-
.component('dragAndDropExample', {
51-
template: `<ul ng-sortable=$ctrl.sortableConf>
52-
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']" draggable="false">
53-
<span class="grab-handle">Drag Header</span>
54-
<div>{$ item $}</div>
55-
</li>
56-
</ul>`,
57-
controller: function AppSidebarController() {
58-
var ctrl = this;
59-
ctrl.sortableConf = {
55+
.component('dragAndDropExample', {
56+
template: `<ul ng-sortable=$ctrl.sortableConf>
57+
<li ng-repeat="item in ['burgers', 'chips', 'hotdog']" draggable="false">
58+
<span class="grab-handle">Drag Header</span>
59+
<div>{$ item $}</div>
60+
</li>
61+
</ul>`,
62+
controller: function AppSidebarController() {
63+
var ctrl = this;
64+
ctrl.sortableConf = {
6065
animation: 350,
6166
chosenClass: 'sortable-chosen',
6267
handle: '.grab-handle',
6368
forceFallback: true,
64-
};
65-
},
66-
})
69+
};
70+
},
71+
});
6772
```

0 commit comments

Comments
 (0)