AngularJS角度拖放列表移动项目

时间:2020-06-23 07:45:50

标签: angularjs angular

我正在使用该库:https://github.com/marceljuenemann/angular-drag-and-drop-lists,并带有以下特定示例:http://marceljuenemann.github.io/angular-drag-and-drop-lists/demo/#/nested

要将某项移动到另一个地方,我有dnd-moved="list.splice($index, 1)",但除此之外,我还需要有一个直接放在dnd-drop="onDrop(list, item, index)"上的<ul>。此功能为空,但会覆盖另一个功能,因此我无法正确移动该项目。

1 个答案:

答案 0 :(得分:0)

我将两者结合在一起:

dnd-moved="onDrop(list, item, $index)"

$scope.onDrop = function(list, item, index) {
        list.splice(index, 1);
      };