![](/img/trans.png)
[英]two connected lists with angular-ui/ui-sortable, disable placeholder in one while enabling it in the other
[英]Angular-UI ui-sortable looses sync with bounded array
首先,我要告訴您,我是html / js開發的初學者。
使用angular-ui允許對列表(ul)進行排序,當執行某些操作時,數組將失去與列表的同步。
從...開始 :
$scope.list = ["one", "two", "three", "four"];
和html:
<ul ui:sortable ng:model="list">
<li ng:repeat="item in list" class="item">{{item}}</li>
</ul>
當我拖動(示例)第二個和第三個之間的第一個li元素時,它會更改ul內的位置,但有界項仍在列表數組中的相同位置。
>angular.element($(".ng-scope")).scope().list
["one", "two", "three", "four"];
我創建了一個jsfiddle,可以測試該行為: http : //jsfiddle.net/DmLt2/
如果我們稍微玩一些其他奇怪的行為。
JQuery 1.9.1,JQueryUI 1.10.3,Angular 1.2.2,AngularUI 0.4.0
同時,我在網上找到了jQuery UI Sortable插件包裝器。 進行了較小的更改,我設法使其在這里起作用: http : //jsfiddle.net/42VCK/
但是需要刪除對AngularUI的引用或更改模塊名稱。
誰能給我一些幫助,以使其正常工作?
不知道您使用的是什么角度的用戶界面,但是它已經很老了。 最新的ui-sortable托管在https://github.com/angular-ui/ui-sortable 。 重要說明,要與AngularJS 1.2.x一起使用,您需要根據其自述文件使用ui-sortable分支angular1.2
: https : //github.com/angular-ui/ui-sortable/tree/angular1.2
使用上述源代碼,以下jsfiddle基於您的示例,但使用正確的ui-sortable源代碼除外: http : //jsfiddle.net/BuLdk/1/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.