我正在使用角度拖放列表库来拖放列表中的项目。目前,我看到该项目可以在整个页面中拖动。如何将拖动区域限制在特定区域而不是任何地方。我检查了他们的 API,但我没有看到任何选项。
问问题
636 次
1 回答
0
在 plunker 示例中,您不能在任何地方拖放,只能在 html 元素上使用dnd-draggable
<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>
于 2017-01-17T08:15:20.343 回答