限制角度拖动列表中的拖动区域

时间:2017-01-17 08:04:43

标签: angularjs angulardraganddroplists

我正在使用angular drag drop list library来拖放列表中的项目。目前,我看到该项目在整个页面中都是可拖动的。如何将拖动区域限制为仅限于特定区域而不是所有区域。我检查了他们的API,但我没有看到任何选项。

1 个答案:

答案 0 :(得分:0)

在plunker示例中,您不能拖放每个地方,只能在dnd-draggable

的html元素上拖放
<ul dnd-list="list">
    <!-- The dnd-draggable directive makes an element draggable and will
         transfer the object that was assigned to it. If an element was
         dragged away, you have to remove it from the original list
         yourself using the dnd-moved attribute -->
    <li ng-repeat="item in list"
        dnd-draggable="item"
        dnd-moved="list.splice($index, 1)"
        dnd-effect-allowed="move"
        dnd-selected="models.selected = item"
        ng-class="{'selected': models.selected === item}"
        >
        {{item.label}}
    </li>
</ul>