-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. add new README 2. fix ngDraggable setting issue
- Loading branch information
Xie, Ziyu
committed
May 3, 2017
1 parent
9df93b8
commit fd277a6
Showing
6 changed files
with
171 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,73 @@ | ||
# angular2-draggable | ||
Angular directive (for version >= 2.x ) that makes the DOM element draggable | ||
# angular2-draggable [![npm version](https://badge.fury.io/js/angular2-draggable.svg)](http://badge.fury.io/js/angular2-draggable) [![npm downloads](https://img.shields.io/npm/dm/angular2-draggable.svg)](https://npmjs.org/angular2-draggable) | ||
Angular directive (for version >= 2.x ) that makes the DOM element draggable. Please refer to the [demo](https://xieziyu.github.io/#/angular2-draggable/demo) page. | ||
|
||
## Table of contents | ||
1. [Getting Started](#getting-started) | ||
3. [Installation](#installation) | ||
4. [Usage](#usage) | ||
5. [API](#api) | ||
6. [Events](#events) | ||
|
||
# Getting Started | ||
angular2-draggable 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](https://xieziyu.github.io/#/angular2-draggable/demo) page. | ||
|
||
1. Firstly, import `AngularDraggableModule` in your app module (or any other proper angular module): | ||
```typescript | ||
import { AngularDraggableModule } from 'angular2-draggable'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
..., | ||
AngularDraggableModule | ||
], | ||
... | ||
}) | ||
export class AppModule { } | ||
``` | ||
|
||
2. Then: use `ngDraggable` directive to make the DOM element draggable. | ||
+ Simple example: | ||
|
||
+ html: | ||
```html | ||
<div ngDraggable>Drag me!</div> | ||
``` | ||
|
||
+ Use `[handle]` to move parent element: | ||
|
||
+ html: | ||
```html | ||
<div ngDraggable [handle]="DemoHandle" class="card"> | ||
<div #DemoHandle class="card-header">I'm handle. Drag me!</div> | ||
<div class="card-block">You can't drag this block now!</div> | ||
</div> | ||
``` | ||
|
||
# API | ||
|
||
## Directive: | ||
`ngDraggable` directive support following input porperties: | ||
+ `ngDraggable`: boolean. You can toggle the draggable capability by setting `true`/`false` to `ngDraggable` | ||
|
||
+ `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: | ||
|
||
```css | ||
.ng-draggable { | ||
cursor: move; | ||
} | ||
``` | ||
|
||
# Events | ||
|
||
To be supported soon. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Xie, Ziyu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# angular2-draggable [![npm version](https://badge.fury.io/js/angular2-draggable.svg)](http://badge.fury.io/js/angular2-draggable) [![npm downloads](https://img.shields.io/npm/dm/angular2-draggable.svg)](https://npmjs.org/angular2-draggable) | ||
Angular directive (for version >= 2.x ) that makes the DOM element draggable. Please refer to the [demo](https://xieziyu.github.io/#/angular2-draggable/demo) page. | ||
|
||
## Table of contents | ||
1. [Getting Started](#getting-started) | ||
3. [Installation](#installation) | ||
4. [Usage](#usage) | ||
5. [API](#api) | ||
6. [Events](#events) | ||
|
||
# Getting Started | ||
angular2-draggable 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](https://xieziyu.github.io/#/angular2-draggable/demo) page. | ||
|
||
1. Firstly, import `AngularDraggableModule` in your app module (or any other proper angular module): | ||
```typescript | ||
import { AngularDraggableModule } from 'angular2-draggable'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
..., | ||
AngularDraggableModule | ||
], | ||
... | ||
}) | ||
export class AppModule { } | ||
``` | ||
|
||
2. Then: use `ngDraggable` directive to make the DOM element draggable. | ||
+ Simple example: | ||
|
||
+ html: | ||
```html | ||
<div ngDraggable>Drag me!</div> | ||
``` | ||
|
||
+ Use `[handle]` to move parent element: | ||
|
||
+ html: | ||
```html | ||
<div ngDraggable [handle]="DemoHandle" class="card"> | ||
<div #DemoHandle class="card-header">I'm handle. Drag me!</div> | ||
<div class="card-block">You can't drag this block now!</div> | ||
</div> | ||
``` | ||
|
||
# API | ||
|
||
## Directive: | ||
`ngDraggable` directive support following input porperties: | ||
+ `ngDraggable`: boolean. You can toggle the draggable capability by setting `true`/`false` to `ngDraggable` | ||
|
||
+ `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: | ||
|
||
```css | ||
.ng-draggable { | ||
cursor: move; | ||
} | ||
``` | ||
|
||
# Events | ||
|
||
To be supported soon. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters