# msinghthakur

> Drag and Drop for Angular2 and beyond!

Latest version **2.2.0** (published 2017-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install msinghthakur
pnpm add msinghthakur
yarn add msinghthakur
bun add msinghthakur
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2017-07-27 |
| First published | 2017-07-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | msinghthakur |
| Keywords | angular2, dnd, drag, drop, angular |

## Links

- npm: https://www.npmjs.com/package/msinghthakur
- npm.io page: https://npm.io/package/msinghthakur

## Dependencies (1)

- [dragula](https://npm.io/package/dragula.md) ^3.7.2

## Recent versions

- 2.2.0 (latest) — 2017-07-27

## README

# ngx-dnd [![Codacy Badge](https://api.codacy.com/project/badge/Grade/06120385a7c84f18801b7b7c36e9fc82)](https://www.codacy.com/app/hypercubed/ngx-dnd?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=swimlane/ngx-dnd&amp;utm_campaign=Badge_Grade)

🕶  Drag, Drop and Sorting Library for Angular4 and beyond!

*Note: This project is under heavy construction. As such, the API may change dramatically between major releases and documentation is lacking.*

## Features

- Drag and Drop
- Sorting
- Events (drag, drop, over, out)
- Nesting
- Touch support
- Templating

## Quick intro and examples

### Directives

`ngx-dnd` provides a base set of directives to enable drag-and-drop.  By default all children of a `ngxDroppable` element may be dragged and dropped.  Add the `ngxDraggable` to restrict drag-and-drop to the parent container.  In general prefer using the base directives to the help components introduced later.

```html
<div class="ngx-dnd-container" ngxDroppable>
  <div class="ngx-dnd-item" ngxDraggable>Item 1</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3</div>
</div>
```

Give multiple containers the same `dropZone` name to allow drag-and-drop between these containers.

```html
<div class="ngx-dnd-container" ngxDroppable="example">
  <div class="ngx-dnd-item" ngxDraggable>Item 1a</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2a</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3a</div>
</div>
<div class="ngx-dnd-container" ngxDroppable="example">
  <div class="ngx-dnd-item" ngxDraggable>Item 1b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3b</div>
</div>
```

`ngxDraggable` items can be restricted to specific containers:

```html
<div class="ngx-dnd-container" ngxDroppable>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 1a</div>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 2a</div>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 3a</div>
</div>
<div class="ngx-dnd-container" ngxDroppable="example-target">
  <div class="ngx-dnd-item" ngxDraggable>Item 1b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3b</div>
</div>
```

### Components

`ngx-dnd` provides a set of helper components that encapsulates the directives mentioned and adds capability for data driven structures.  In general you should prefer directives to components.

```js
orderableLists = [
  [
    "Item 1a",
    "Item 2a",
    "Item 3a"
  ],
  [
    "Item 1b",
    "Item 2b",
    "Item 3b"
  ]
]
```

```html
<ngx-dnd-container
  [model]="orderableLists">
</ngx-dnd-container>
```

This component is effectively equivalent to:

```html
<div class="ngx-dnd-container" ngxDroppable [model]="orderableLists">
  <div
    class="ngx-dnd-item"
    ngxDraggable
    *ngFor="let item of orderableLists">{{item}}</div>
</div>
```

Including nested containers:

```html
<ngx-dnd-container
  [model]="nestedLists">
</ngx-dnd-container>
```

```js
nestedLists = [
  {
    "label": "Item 1",
    "children": []
  },
  {
    "label": "Item 2",
    "children": [
      {
        "label": "Item 2a",
        "children": []
      },
      {
        "label": "Item 2b",
        "children": []
      },
      {
        "label": "Item 2c",
        "children": []
      }
    ]
  },
  {
    "label": "Item 3",
    "children": [
      {
        "label": "Item 3a",
        "children": []
      },
      {
        "label": "Item 3b",
        "children": []
      },
      {
        "label": "Item 3c",
        "children": []
      }
    ]
  }
]
```

See [https://swimlane.github.io/ngx-dnd/](https://swimlane.github.io/ngx-dnd/) for more lives examples.  Demo code is at [https://github.com/swimlane/ngx-dnd/tree/master/demo](https://github.com/swimlane/ngx-dnd/tree/master/demo).

## Install
To use ngx-dnd in your project install it via [npm](https://www.npmjs.com/package/@swimlane/ngx-dnd):

* `npm i @swimlane/ngx-dnd --save`
* Add `NgxDnDModule` to your application module

## Development

Modified for Local User from https://github.com/swimlane/ngx-dnd

---
_Source: https://npm.io/package/msinghthakur · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
