Giter Site home page Giter Site logo

lvldragdrop's Introduction

#Native AngularJs drag and drop directive#

An easy to use, native, directive to enable drag/drop in your angular app. This directive has no dependency on jQuery or other frameworks, it does require a browser that supports the HTML5 drag/drop events.

Live Demo

Documentation

##UUID Service## A very simple service for working with UUIDs.

Live Demo

Documentation

dataTransfer hack

The jQuery event object does not have a dataTransfer property... true, but one can try:

jQuery.event.props.push('dataTransfer');

lvldragdrop's People

Contributors

danielbsig avatar giwi avatar kandadaboggu avatar logicbomb avatar srguiwiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lvldragdrop's Issues

Reorder elements in the same Dropped area.

I'm using the directive to move elements from one table to the other, at the same time I want to re-order (move up and down) the elements (in the same table) using this directive. Anyone can help me on how to achieve the goal?
image

Problem with Jquery

Hi,

there seem to be problems when jquery is in the same project.

Here a plunkr: http://plnkr.co/edit/e59nazSpdaRxuyAqM0BO?p=preview

 Uncaught TypeError: Cannot call method 'setData' of undefined lvl-drag-drop.js:19
 Uncaught TypeError: Cannot set property 'dropEffect' of undefined lvl-drag-drop.js:51
 Uncaught TypeError: Cannot call method 'getData' of undefined lvl-drag-drop.js:74

I will try to find out what this might be.
I guess jQuery is important enough - even with angular - that there should be a way to get you script play nicely with jQuery

AngularJS 1.3 support

AngularJS is now giving this error: "Referencing DOM nodes in Angular expressions is disallowed!", because of this: on-drop="controller.dropped(dragEl, dropEl)".

Is there a quick fix for this?

Colossal Memory Leak

Hi

In a frequent timer updating the scope with the drag / drops inside a ng-repeat I managed to get 4GB after just 2 mins. Beta that!! :)

lvlDropTarget needs:

scope.$on('$destroy', function() {
drag_start_event();
drag_end_event();
});

with:

var drag_start_event = $rootScope.$on("LVL-DRAG-START", function() {

and

var drag_end_event = $rootScope.$on("LVL-DRAG-END", function() {

I'm not tested it but I think you can also change $rootScope to $scope for those listeners

Either way you end up with huge memory build up with all those listeners on the rootScope unless addresses with one or the other solution.

That's my sight noob Angular take on it anyway.

Nige
PS: Thanks for the code, I hacked it to cope with dragable child elements inside a dropable one.

how to make the input and textarea draggable

I am trying to add the textarea and input draggable,

I make the javascript like this:

    $scope.dropped = (dragEl, dropEl) ->
            drag = angular.element(dragEl)
            drop = angular.element(dropEl)
            initial = drop[0].innerHTML

    # console.log("The element " + drag.attr('id') + " has been dropped on " + drop.attr('id') + "!")

    drop[0].innerHTML = drag[0].innerHTML
    drag[0].innerHTML = initial

    console.log(drag[0].innerHTML)
    console.log(drop[0].innerHTML)
    console.log(drop)
    return true

but seems, textarea and input does not support to find innerhtml, how should I do?

Thanks!

AngularJs make an element draggable or droppable dynamically in DOM

Great work, thanks logicbomb.

Actually i am looking for any directive or anything that works with angularJs to make an element draggable or droppable dynamically in DOM.

Like there is an element in DOM which is draggable, i want to make it droppable and disable its draggable properties.

I tried it with firebug by removing it all draggable attributes, but i does not work. Can we do this?

bower repository not found error

When I try to install lvlDragDrop via bower, I get an error that says repository not found. Did you changed your repository name or account?

> bower info lvlDragDrop
bower not-cached    git://github.com/reykjavik-university/lvlDragDrop.git#*
bower resolve       git://github.com/reykjavik-university/lvlDragDrop.git#*
bower ECMDERR       Failed to execute "git ls-remote --tags --heads git://github.com/reykjavik-university/lvlDragDrop.git", exit code of #128 fatal: remote error:    Repository not found.

Registered as a bower component

I noticed the project doesn't have a bower.json file, which is necessary in order to install it via bower. I've forked the project and created such a file in that repo, and I can create a pull request if you would like to add that file to this project.

Can not change $scope inside drop callback

angular.module('MyApp', ['lvl.directives.dragdrop'])
.controller('MyController', function ($scope) {
  $scope.fieldDropped = function (dragEl, dropEl) {
    $scope.shouldBeChanged = 'but not';
  };
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.