Thanks for the base:
https://xieziyu.github.io/#/angular2-draggable/demo
Table of contents
Getting Started
angular-dragon is an angular (ver >= 2.x) directive that makes the DOM element draggable. (Note that: It's different from drag-and-drop)
Installation
npm install angular2-draggable --save
Usage
Please refer to the demo page.
-
Firstly, import
AngularDragon
in your app module (or any other proper angular module):; -
Then: use
ngDraggable
directive to make the DOM element draggable.-
Simple example:
- html:
Drag me! -
Use
[handle]
to move parent element:- html:
I'm handle. Drag me!You can't drag this block now!
-
API
Directive:
ngDraggable
directive support following input porperties:
-
ngDraggable
: boolean. You can toggle the draggable capability by settingtrue
/false
tongDraggable
-
handle
: HTMLElement. Use template variable to refer to the handle element. Then only the handle element is draggable.
CSS:
When ngDraggable
is enabled on some element, ng-draggable
class is automatically assigned to it. You can use it to customize the pointer style. For example:
Events
To be supported soon.