codef0rmer / angular-dragdrop

Implementing jQueryUI Drag and Drop functionality in AngularJS (with Animation) is easier than ever
http://codef0rmer.github.com/angular-dragdrop/#/
MIT License
1.78k stars 574 forks source link

Unable to pass value into callbacks #309

Closed olyjosh closed 7 years ago

olyjosh commented 7 years ago

So after spending so much time trying to find a way of calling a function that takes values using a callbacks options such as onDrop, onStop, I was unable to figure it out. Please consider this attribute

jqyoui-draggable="{index: {{$index}},animate:true, onStop : 'updateStatus' }"

where my function updateStatus in my controller looks like

$scope.updateStatus = function (id) { console.log(id); }

So, how do I pass a value to function updateStatus as my id. This use case is in ng-repeat so I may not be able to keep a state variable in my controller since I'm dealing with elements in array. I have tried jqyoui-draggable="{index: {{$index}},animate:true, onStop : 'updateStatus(123)' }" but no luck.

olyjosh commented 7 years ago

This solved it https://github.com/codef0rmer/angular-dragdrop/issues/175

But damn stressful. Got angular complicated