Here is the code snippet I am working with:
angular.module('ExampleApp', ['ngDraggable']).
controller('MainCtrl', function ($scope) {
$scope.centerAnchor = true;
$scope.toggleCenterAnchor = function () {$scope.centerAnchor = !$scope.centerAnchor}
$scope.draggableObjects = [{name:'subject1'}, {name:'subject2'}, {name:'subject3'}];
$scope.droppedObjects1 = [];
$scope.droppedObjects2 = [];
$scope.onDropComplete1=function(data,evt,i){
var index = $scope.droppedObjects1.indexOf(data);
if (index == -1)
$scope.droppedObjects1.push(data);
}
$scope.onDragSuccess1=function(data,evt){
console.log("133","$scope","onDragSuccess1", "", evt);
var index = $scope.droppedObjects1.indexOf(data);
if (index > -1) {
$scope.droppedObjects1.splice(index, 1);
}
}
var inArray = function(array, obj) {
var index = array.indexOf(obj);
}
});
I need to pass variable "i" into a function call and use it in this way:
var index = $scope.droppedObjects+i.indexOf(data);
. How can I achieve this?