【发布时间】:2014-05-26 20:48:38
【问题描述】:
我需要一个带角度的拖放列表,但我也需要 $scope.list 更改,因为我必须将新订单存储在我的数据库中。
我找到了this answer,我用它得到了这个http://jsfiddle.net/aras7/9sueU/1/
var myapp = angular.module('myapp', ['ui']);
myapp.controller('controller', function ($scope) {
$scope.list = ["one", "two", "three", "four", "five", "six"];
});
angular.bootstrap(document, ['myapp']);
问题是当我尝试从上到下更改元素时,一个位置不起作用。
例如,将“一”降低一个位置以得到“二”、“一”、“三”、“四”,......第二个列表也应该改变,但它没有。
two
one
three
five
four
six
----------
one
two
three
five
four
six
两个列表应该相等。
【问题讨论】:
-
@AbrahamUribe 我看到了这个问题和被接受的答案有同样的问题,看看jsfiddle.net/g/hKYWr
-
这似乎是 ui sortable 上的一个错误
-
我是这么想的,但我不确定,有什么建议/建议吗?
-
你需要包含 sortable.js https://github.com/angular-ui/ui-sortable/tree/master/src 并像这样启动模块 var myapp = angular.module('myapp', ['ui.sortable']); http://jsfiddle.net/9sueU/3/
标签: jquery angularjs list jquery-ui drag-and-drop