我使用拖放library
我使用指令来拖动元素:
dnd-moved="movedSongCallback(list, $index)"
功能:
$scope.movedSongCallback = function (data, index){
data.people.splice(index, 1);
});
所以,在功能内部,我变老data
而不是修改。
如何在拖动后获取修改后的对象?
答案 0 :(得分:1)
dragend事件在本地event
变量中提供:
dnd-moved="movedSongCallback(list, $index, event)"
JS
$scope.movedSongCallback = function (data, index, event){
data.people.splice(index, 1);
console.log(event.currentTarget);
console.log(event.relatedTarget);
});