THE SITUATION:
I have an app that make use of angular drag and drop.
Everything is working fine except one thing. I need to pass one parameter in the onStart callback function, but i don't know how. I search around and try several possibilities but without success. The function itself is working, has been called and properly executed, the only problem i have is to pass a parameter to it.
THE CODE:
In this example there one of the attempt i have made.
<div class="col-sm-4">
<div class="thumbnail" data-drop="true" ng-model='todo_list' jqyoui-droppable="{multiple:true, onDrop:'update_item()'}">
<div class="caption">
<div class="btn btn-info btn-draggable" ng-repeat="item in todo_list track by $index" ng-show="item.title" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" ng-model="todo_list" jqyoui-draggable="{index: {{$index}}, onStart:'set_board_item_id_panel(event, ui, {board_item_id: item.board_item_id})'}">{{item.title}}</div>
</div>
</div>
</div>
THE QUESTION:
How can i pass a parameter in the callback function of angular drag and drop?
Thank you very much!
You don't need to pass in parameters event
and ui
, those are the first 2 default arguments.
Replace ...
onStart:'set_board_item_id_panel(event, ui, {board_item_id: item.board_item_id})'
With ...
onStart:'set_board_item_id_panel({board_item_id: item.board_item_id})'
Then in your Controller do this ...
....
$scope.set_board_item_id_panel = function (event, ui, board_item_id) {
console.log(board_item_id);
}
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With