mrphilipandrews/ngDraggable
关于
AngularJS 的拖放模块
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文ngDraggable
NOTE: I'm not actively maintaining this project any more. If any anyone would like to take on that responsible please get in touch
Drag and drop module for Angular JS with support for touch devices. demo.
Usage:
- Install:
bower install ngDraggable - Add
angularandngDraggableto your code:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src="ngDraggable.js"></script>
- Add a dependency to the
ngDraggablemodule in your application.
angular.module('app', ['ngDraggable']);
- Add attribute directives to your html:
Draggable usage:
<div ng-drag="true" ng-drag-data="{obj}" ng-drag-success="onDragComplete($data,$event)" ng-center-anchor="true">
Draggable div
</div>
ng-center-anchoris optional. If not specified, it defaults to false.- If the draggable is also clickable (ng-click, ng-dblclick) the script wont react.
- You can define a drag-button as child with the attribute
ng-drag-handle.
ng-drag-start and ng-drag-move is also available. Add to the ng-drop element.
ng-drag-stop can be used when you want to react to the user dragging an item and it wasn't dropped into the target container.
draggable:start, draggable:move and draggable:end events are broadcast on drag actions.
Drop area usage:
<div ng-drop="true" ng-drop-success="onDropComplete($data,$event)" >
Drop area
</div>
Angular Controller:
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);
}
};
Examples
Pull requests
We welcome pull requests but please check that all the examples still work if you modified the source base. There have been serveral PRs recently that broke core functionality. If you are feeling really keen you could include some protractor test cases in your PR.
探索相关项目
加载中…