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.
ngx-draggable-dom
Advanced tools
Angular attribute directive that causes any element to become a draggable element.
Angular attribute directive that causes any element to become a draggable element.
This package provides a directive for Angular 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. The initial fork was known as ng2-draggable-dom and was deprecated in favor of this package that runs using the latest Angular dependencies and tools for libraries.
npm install ngx-draggable-dom --save
Import NgxDraggableDomModule
in your app module (or other Angular module) and place it in your imports section:
import { NgxDraggableDomModule } from "ngx-draggable-dom";
@NgModule({
imports: [
...,
NgxDraggableDomModule,
],
...
})
export class AppModule { }
Use the ngxDraggableDom
directive to make a DOM element draggable.
<div ngxDraggableDom="true">Drag me!</div>
Import ngx-draggable-dom.scss
to your application's styles or add it to your angular.json
if you use the CLI tools.
Explore the API of inputs and outputs to help make your element drag just the way you would like, or run the wrapper project to test it out with some pre-designed examples!
ngxDraggableDom
{boolean}
true
: The element can be dragged.false
: The element cannot be dragged.handle
{HTMLElement}
bounds
{HTMLElement}
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.requireMouseOver
{boolean}
true
: The draggable element will be put back down as soon as the mouse leaves the HTMLElement.false
(default): The draggable element will always follow the mouse position as long as the mouse is held down.requireMouseOverBounds
{boolean}
true
: The draggable element will not move when it is constrained by a bounds edge and the mouse position is outside of the bounds.false
: The draggable element can still move in an unconstrained direction while it is being constrained in another and the mouse position is outside of the bounds.ignoreMultiTouchEvents
{boolean}
true
: The object will not move for multi touch gestures, allowing you to support a single touch for movement and multi-touch for other functionality at the same time.false
: The object will move for any type of touch event that interacts with it, whether a single touch or multi-touch gesture.started
{NgxDraggableDomMoveEvent}
stopped
{NgxDraggableDomMoveEvent}
moved
{NgxDraggableDomMoveEvent}
edge
{NgxDraggableDomBoundsCheckEvent}
bounds
is set, this event will be fired defining the state of the interaction between the element and the bounds constraints. This event will be fired for every movement that collides with the bounds when constraining and when the end user stops dragging.target
{HTMLElement}
position
{NgxDraggablePoint}
top
{boolean}
true
.right
{boolean}
true
.bottom
{boolean}
true
.left
{boolean}
true
.constrainedCenter
{NgxDraggablePoint}
translation
{NgxDraggablePoint}
isConstrained
{boolean}
true
.reset()
{void}
When ngxDraggableDom
is enabled on some element, the ngx-draggable
class is automatically assigned to it. When the user is actively dragging the element, the class ngx-dragging
is applied to the element (or the specified handle). If you include the provided ngx-draggable-dom.scss
styles into your project from node_modules/ngx-draggable-dom/styles/ngx-draggable-dom.scss
, you will receive native styling and support for turning off CSS transitions while interacting with the element. You can override these to customize the look and feel for when you are interacting with the element. For example, change the cursor style for draggable elements in your page by doing the following:
.ngx-draggable {
cursor: move;
}
.ngx-dragging {
cursor: grabbing !important;
}
FAQs
Angular attribute directive that causes any element to become a draggable element.
The npm package ngx-draggable-dom receives a total of 2,277 weekly downloads. As such, ngx-draggable-dom popularity was classified as popular.
We found that ngx-draggable-dom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.