angular-dragdrop
angular-dragdrop copied to clipboard
revert item to the origin place if it is outside of dropped objects
If you finish dragging element outside dropped objects, the element doesn't move to original place, just stays where the dragging finished. In some cases you want to move it to the original position.
if you want to turn on, set parameter revertFromOutside to true, for example jqyoui-droppable="{index: {{$index}}, revertFromOutside: true}"
You can revert don't edit library
By edit js of property BeforeDrop
<nameBeforeDrop> is name func of Before Drop
$scope.<nameBeforeDrop> = function (e, ui) {
if (<condition>) {
// something
$(ui.draggable[0]).draggable( "option", "revert", true );
$(ui.draggable[0]).draggable( "option", "revertDuration", 200 );
var deferred = $q.defer();
return deferred.promise;
}
}