File tree 2 files changed +36
-1
lines changed
2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1
1
< section ng-app ="sortableApp ">
2
+ < h1 > Sortable items</ h1 >
2
3
< div ng-controller ="sortableController " class ="section row ">
3
4
< div class ="col-sm-offset-2 col-sm-4 ">
4
5
< ul ui-sortable ="sortableOptions " ng-model ="list " class ="list ">
11
12
</ ul >
12
13
</ div >
13
14
</ div >
15
+
16
+ < h1 > Connected items</ h1 >
17
+ < div ng-controller ="connectedController " class ="section row ">
18
+ < div class ="col-sm-offset-2 col-sm-4 ">
19
+ < ul ui-sortable ="sortableOptions " ng-model ="leftArray " class ="list ">
20
+ < li ng-repeat ="item in leftArray " class ="item "> {{item.text}}</ li >
21
+ </ ul >
22
+ </ div >
23
+ < div class ="col-sm-4 ">
24
+ < ul ui-sortable ="sortableOptions " ng-model ="rightArray " class ="list ">
25
+ < li ng-repeat ="item in rightArray " class ="item "> {{item.text}}</ li >
26
+ </ ul >
27
+ </ div >
28
+ </ div >
14
29
</ section >
Original file line number Diff line number Diff line change @@ -28,4 +28,24 @@ myapp.controller('sortableController', function ($scope) {
28
28
$scope . sortingLog . push ( logEntry ) ;
29
29
}
30
30
} ;
31
- } ) ;
31
+ } ) ;
32
+
33
+ myapp . controller ( 'connectedController' , function ( $scope ) {
34
+ function buildArray ( name , size ) {
35
+ var i , array = [ ] ;
36
+ for ( i = 1 ; i <= size ; i = i + 1 ) {
37
+ array . push ( {
38
+ text : name + ' ' + i ,
39
+ value : i
40
+ } ) ;
41
+ }
42
+
43
+ return array ;
44
+ }
45
+
46
+ $scope . leftArray = buildArray ( 'Left' , 5 ) ;
47
+ $scope . rightArray = buildArray ( 'Right' , 7 ) ;
48
+ $scope . sortableOptions = {
49
+ connectWith : '.list'
50
+ } ;
51
+ } ) ;
You can’t perform that action at this time.
0 commit comments