I have a global variable that I am updating with JSON data upon clicking. Strangely, the global variable gets updated even when I'm not actively clicking on anything.
$scope.save = function() { // method invoked when clicked
DataBasket.users = $scope.usersPermissions; // DataBasket is actually a factory responsible for updating the global variable
}
On subsequent clicks, I manipulate the value of $scope.usersPermissions
, but I don't want these changes to be reflected in the global variable.
How can I resolve this issue?