0
我有一個簡單的jsfiddle使用Angular Drag and Drop模塊。 我想要的是:左邊是一張卡片清單。它們中的每一個都是可拖動的。在右側,放置區域。拖放時,該元素被克隆並添加到ctrl.program
列表中。到現在爲止還挺好。使用Angularjs拖放刪除可拖動元素
問題:我必須能夠重新排序,並從右側區域(即program
陣列)移除元件。我嘗試了多種解決方案,但都沒有成功。理想情況下,一個元素在掉落到拖放區域之外(即右列)時被移除。現在,我只需使用一個按鈕
<button class="btn" ng-click="remove(ctrl.program, $index)"> remove </button>
$scope.remove = function(array, index){
array.splice(index, 1);
}
但它拋出
Error: cannot call methods on draggable prior to initialization; attempted to call method 'destroy'
任何想法如何順利進行刪除?