I'm trying to use Angular UI and jQuery UI Sortable to mimic the Connected Lists behavior.
But, the behavior is quite flaky: http://jsfiddle.net/hKYWr/227/ Any ideas?
HTML:
<div ng:controller="controller">
<ul class='mysortable' ui:sortable ui:options="{connectWith:'.mysortable'}" ng:model="list1">
<li ng:repeat="item in list1" class="item">{{item}}</li>
</ul>
<ul class='mysortable' ui:sortable ui:options="{connectWith:'.mysortable'}" ng:model="list2">
<li ng:repeat="item in list2" class="item">{{item}}</li>
</ul>
<hr>
<pre ng-bind="list1 | json"></pre>
<hr>
<pre ng-bind="list2 | json"></pre>
</div>
<script src="http://code.angularjs.org/1.0.2/angular.min.js"></script>
<script src="https://raw.github.com/angular-ui/angular-ui/master/build/angular-ui.min.js"></script>
JS:
var myapp = angular.module('myapp', ['ui']);
myapp.controller('controller', function ($scope) {
$scope.list1 = ["1", "2", "3"];
$scope.list2 = ["A", "B", "C"];
});
angular.bootstrap(document, ['myapp']);
CSS:
ul {
display: inline-block;
}
.item {
padding: 2px;
width: 50px;
height: 20px;
border: 1px solid #333;
background: #EEE;
}
This will be fixed in the next version (v0.4.0) of AngularUI
Here's an example using the default ui-sortable: http://jsfiddle.net/a9fFC/3 But I didn't get the model to reflect the update.
But with angular-ui-multi-sortable I got it working: http://jsfiddle.net/a9fFC/6/
<div ng-controller="controller">
<ul ui-multi-sortable ng-model="list">
<li ng-repeat="item in list" class="item">{{item}}</li>
</ul>
<hr />
<div ng-repeat="item in list">{{item}}</div>
</div>
js:
var myapp = angular.module('myapp', ['ui']);
myapp.controller('controller', function ($scope) {
$scope.list = ["one", "two", "three", "four", "five", "six"];
});
angular.bootstrap(document, ['myapp']);
5 bitcoins says it's angular ui, and it's collaterally affecting jquery ui library