Drag and drop module for Angular JS with support for touch devices. demo
.
- Include the
ngDraggable.js
script provided by this component into your app. - Add
ngDraggable
as a module dependency to your app.
Draggable usage:
<div ng-drag="true" ng-drag-data="{obj}" ng-drag-success="onDragComplete($data,$event)" >
Draggable div
</div>
Drop area usage:
<div ng-drop="true" ng-drop-success="onDropComplete($data,$event)" >
Drop area
</div>
app.controller('MainCtrl', function ($scope) {
$scope.onDragComplete=function(data,evt){
console.log("drag success, data:", data);
}
$scope.onDropComplete=function(data,evt){
console.log("drop success, data:", data);
}
};