you can see that the ruleCounter property in object being inserted is 1 and after insertion in the array we can see that the ruleCounter property has value 1 Then I try to insert same object but this time ruleCounter has a value of 2 but magically in the array you can see that the value of ruleCounter in both objects in the array becomes 2
please help why the values of ruleCounter in different index of the array gets automatically updated
var droppedObjects = []; //this array will contain the list of rules dropped on the drop zone area.
$scope.onDropComplete1 = function(data, evt) {
ruleCounter++;
data.ruleCounter= ruleCounter;
console.log(data);
//var index = $scope.droppedObjects.indexOf(data);
if (data !== null) {
droppedObjects.push(data); //droping data into the array when drag and drop is complete
console.log(droppedObjects);
} else {
//console.log($scope.droppedObjects1);
}
};