I need to implement a confirm modal dialog (UI Kit) when an element is dragged into a new bag using angular 1.4.8 and angular-dragula. If the user clicks ok, the process should continue, but if they click NO, the element should return to its original bag.
Here's my code so far:
dragulaService.options($scope, 'tasks', {
revertOnSpill: true
});
$scope.$on('tasks.drop', function (e, el, target, source) {
if (target[0].id == 'done') {
UIkit.modal.confirm("Are you sure?", function(){
console.log('drag confirmed');
}, function(){
// function to cancel the drop...
});
} else {
console.log('drag confirmed - no modal required');
}
});
The dialog is displaying correctly, and clicking NO triggers the event, but I am unable to find how to cancel the drop. I searched through dragula's documentation with no success.
Appreciate any help on this matter.