Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
angular-draganddrop
Advanced tools
Drag and drop directives for Angular using native HTML5 API.
bower install angular-draganddrop
npm install angular-draganddrop
HTML :
<!-- Load files. -->
<script src="angular.js"></script>
<script src="angular-draganddrop.js"></script>
<div ng-controller="DragDropCtrl">
<!-- Draggable element. -->
<div draggable="true" effect-allowed="copy" draggable-type="custom-object" draggable-data="{foo: 'bar'}"></div>
<!-- Dropzone element. -->
<div drop="onDrop($data, $event)" drop-effect="copy" drop-accept="'json/custom-object'" drag-over="onDragOver($event)" drag-over-class="drag-over-accept"></div>
</div>
JavaScript :
angular.module('controllers.dragDrop', ['draganddrop'])
.controller('DragDropCtrl', function ($scope) {
// Drop handler.
$scope.onDrop = function (data, event) {
// Get custom object data.
var customObjectData = data['json/custom-object']; // {foo: 'bar'}
// Get other attached data.
var uriList = data['text/uri-list']; // http://mywebsite.com/..
// ...
};
// Drag over handler.
$scope.onDragOver = function (event) {
// ...
};
});
The draggable directive serializes data as JSON and prefix the specified type with "json/".
The drop directive automatically unserializes data with the "json" format, other data are not formatted.
All navigators that support the native HTML5 API should be supported.
Tested on Firefox 24+, Chrome 31+.
MIT
FAQs
Drag and drop directives for Angular using native HTML5 API.
The npm package angular-draganddrop receives a total of 9 weekly downloads. As such, angular-draganddrop popularity was classified as not popular.
We found that angular-draganddrop 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.