Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onDropComplete cannot get the element that I dropped into #248

Open
treidio opened this issue May 25, 2016 · 1 comment
Open

onDropComplete cannot get the element that I dropped into #248

treidio opened this issue May 25, 2016 · 1 comment

Comments

@treidio
Copy link

treidio commented May 25, 2016

how can I get the drop element passed into ondropcomplete?
stumped for days.. it seems a recuring question
thx in advance

@treidio
Copy link
Author

treidio commented May 26, 2016

got it. I know its bad to access the dom element directly, but I'm dropping onto a scrolling section so I have to change the draggables parent on drop so it moves with the scrolling, yet remains a draggable so I can drag it to another position

first I do this ~ line 242 - add the scope.el assignment

link: function (scope, element, attrs) {
                    scope.value = attrs.ngDrop;
                    scope.el = element;
                    scope.isTouching = false;

and then ~ line 318 I add the $dropscope to the object.

onDropCallback(scope, {$data: obj.data, $event: obj, $dropscope : scope, $target: scope.$eval(scope.value)});

and then in the html
ng-drop-success="onDropComplete($data,$event,$dropscope)"

and finally in my js

     $scope.onDropComplete=function(data,event,dropscope){
               console.log(dropscope.el);    
    };

hope this helps someone, if theres a better way, let me know.

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant