![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
angular-dragula
Advanced tools
Drag and drop so simple it hurts
Official Angular wrapper for dragula
.
Try out the demo!
You can get it on npm.
npm install angular-dragula --save
Or bower, too. (note that it's called angular-dragula.js
in bower)
bower install angular-dragula.js --save
You'll need to pass in angularDragula
to your module when booting up your application. angular-dragula
takes your angular
instance and uses it to register its own module, service, and directive.
var angular = require('angular');
var angularDragula = require('angular-dragula');
var app = angular.module('my-app', [angularDragula(angular)]);
This package isn't very different from dragula
itself. I'll mark the differences here, but please refer to the documentation for dragula
if you need to learn more about dragula
itself.
There's a dragula
directive (as seen in the demo) that allows you to group containers together, as long as they belong to the same scope. That grouping of containers is called a bag
.
<div dragula='"bag-one"'></div>
<div dragula='"bag-one"'></div>
<div dragula='"bag-two"'></div>
If you need to configure the drake
(there's only one drake
per bag
), you'll have to use the dragulaService
.
app.controller('ExampleCtrl', ['$scope', 'dragulaService',
function ($scope, dragulaService) {
dragulaService.options($scope, 'third-bag', {
removeOnSpill: true
});
}
]);
Whenever a drake
instance created with the dragula
directive emits an event, that event is replicated on the Angular $scope
where the drake
has an associated bag
, and prefixed with the name
on its bag
.
<div dragula='"evented-bag"'></div>
app.controller('ExampleCtrl', ['$scope', function ($scope) {
$scope
.$on('evented-bag.over', function (e, el) {
el.addClass('over');
})
.$on('evented-bag.out', function (e, el) {
el.removeClass('over');
});
]);
Note that these derived events don't expose the DOM elements directly. The elements get wrapped in angular.element
calls.
dragulaService
This service exposes a few different methods with which you can interact with dragula
in the Angular way.
dragulaService.add(scope, name, drake)
Creates a bag
scoped under scope
and identified by name
. You should provide the entire drake
instance. Typically, the directive takes care of this step.
dragulaService.options(scope, name, options)
Sets the options
used to instantiate a drake
. Refer to the documentation for dragula
to learn more about the options
themselves.
dragulaService.find(scope, name)
Returns the bag
for a drake
instance. Contains the following properties.
name
is the name that identifies the bag under scope
drake
is the raw drake
instance itselfdragulaService.destroy(scope, name)
Destroys a drake
instance named name
scoped under scope
.
MIT
FAQs
Drag and drop so simple it hurts
The npm package angular-dragula receives a total of 1,468 weekly downloads. As such, angular-dragula popularity was classified as popular.
We found that angular-dragula demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.