Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
ng2-draggable-dom
Advanced tools
## Table of contents 1. [About This Package](#about-this-package) 2. [Latest News](#latest-news) 3. [Installation](#installation) 4. [Usage](#usage) 5. [API](#api)
Deprecated draggable DOM element directive. Keep on the look out for a new ngx version.
ng2-draggable-dom is a directive for Angular 2+ that makes any DOM element draggable. This project began as a fork of the angular2-draggable directive by xieziyu and was created to provide a more robust set of features and to keep package releases on the bleeding edge.
There are long term plans for major enhancements to this package, so stay tuned and please report any issues you have with existing functionality.
Always check the CHANGELOG for what's brand new and for all the gooey details! See the top of this readme to see what the current version of this module is.
npm install ng2-draggable-dom --save
Import DraggableDomModule
in your app module (or other proper angular module) and place it in your imports section:
import { DraggableDomModule } from "ng2-draggable-dom";
@NgModule({
imports: [
...,
DraggableDomModule,
],
...
})
export class AppModule { }
Use the ngDraggable
directive to make a DOM element draggable.
<div ngDraggable>Drag me!</div>
Explore the API of inputs and outputs to help make your element drag just the way you would like!
ngDraggable
{boolean}
true
: the element can be dragged.false
: the element cannot be dragged.handle
{HTMLElement}
{HTMLElement}
: The element that should be used as the selectable region to drag.bounds
{HTMLElement}
{HTMLElement}
: The element that represents the region the entire draggable element should be kept within. Note, by setting this property you are not forcing it to be constrained within the bounds.constrainByBounds
{boolean}
true
: if bounds
is set, the draggable element will be constrained by that HTMLElement.false
(default): if bounds
is set, the draggable element will just report which boundary edge has been passed by in the edge
output emitter.started
{target: nativeElement, position: IPosition} as {IMoveEvent} (exported interface):
$event.target
.$event.position
as an IPosition {x, y}
.stopped
{target: nativeElement, position: IPosition} as {IMoveEvent} (exported interface):
$event.target
.$event.position
as an IPosition {x, y}
.moved
{target: nativeElement, position: IPosition} as {IMoveEvent} (exported interface):
$event.target
.$event.position
as an IPosition {x, y}
.edge
{top: boolean, right: boolean, bottom: boolean, left: boolean} as IBounds (exported interface):
bounds
is set, this output will emit an object defining the state of constraint for each edge of the HTMLElement defined by bounds
.reset()
{void}:
When ngDraggable
is enabled on some element, the ng-draggable
class is automatically assigned to it. You can use it to customize it. For example, change the cursor style for draggable elements in your page by doing the following:
.ng-draggable {
cursor: move;
}
FAQs
## Table of contents 1. [About This Package](#about-this-package) 2. [Latest News](#latest-news) 3. [Installation](#installation) 4. [Usage](#usage) 5. [API](#api)
The npm package ng2-draggable-dom receives a total of 5 weekly downloads. As such, ng2-draggable-dom popularity was classified as not popular.
We found that ng2-draggable-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.