File tree Expand file tree Collapse file tree 3 files changed +15
-30
lines changed Expand file tree Collapse file tree 3 files changed +15
-30
lines changed Original file line number Diff line number Diff line change 3232 border : 5px solid # 000 ;
3333 border-radius : 15px ;
3434}
35-
36- .logList : before {
37- background-color : # FFF ;
38- }
39-
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ <h1>Sortable items</h1>
1414 </ div >
1515
1616 < h1 > Connected items</ h1 >
17- < div ng-controller ="connectedController " class ="section row ">
17+ < div ng-controller ="connectedController " class ="section row connectedItemsExample ">
1818 < div class ="col-sm-offset-2 col-sm-4 ">
1919 < ul ui-sortable ="sortableOptions " ng-model ="leftArray " class ="list ">
2020 < li ng-repeat ="item in leftArray " class ="item "> {{item.text}}</ li >
Original file line number Diff line number Diff line change 11
22var myapp = angular . module ( 'sortableApp' , [ 'ui.sortable' ] ) ;
33
4- myapp . controller ( 'sortableController' , function ( $scope ) {
5- 'use strict' ;
6-
7- var tmpList = [ ] ;
8-
9- for ( var i = 1 ; i <= 6 ; i ++ ) {
10- tmpList . push ( {
11- text : 'Item ' + i ,
4+ myapp . buildArray = function ( name , size ) {
5+ var i , array = [ ] ;
6+ for ( i = 1 ; i <= size ; i ++ ) {
7+ array . push ( {
8+ text : name + ' ' + i ,
129 value : i
1310 } ) ;
1411 }
1512
16- $scope . list = tmpList ;
13+ return array ;
14+ } ;
1715
16+ myapp . controller ( 'sortableController' , function ( $scope ) {
17+ 'use strict' ;
18+
19+ $scope . list = myapp . buildArray ( 'Item' , 5 ) ;
1820
1921 $scope . sortingLog = [ ] ;
2022
@@ -31,21 +33,9 @@ myapp.controller('sortableController', function ($scope) {
3133} ) ;
3234
3335myapp . 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 ) ;
36+ $scope . leftArray = myapp . buildArray ( 'Left' , 5 ) ;
37+ $scope . rightArray = myapp . buildArray ( 'Right' , 7 ) ;
4838 $scope . sortableOptions = {
49- connectWith : '.list'
39+ connectWith : '.connectedItemsExample . list'
5040 } ;
5141} ) ;
You can’t perform that action at this time.
0 commit comments