I'm trying to pass a scope into a function and I can't seem to get it to work correctly. Here's what I have -
ng-click="clickFunction(scope1)"
//the function
$scope.clickFunction = function(passedScope){
passedScope = false;
console.log($scope.scope1);
So - it's prett straight forward I just want to pass in the scope and set it to false in this click. When I log the scope after changing it hwever it still says it's true. I also tried -
$scope.passedScope
What I am trying to do is set $scope.scope1 = false. It is set in the top of the controller as true and controls a button nearby by that button having ng-disabled="!scope1", I cant just do a scope1 =!scope! on the click because it goes through a modal to confirm the user wants to complete then runs a modalInstance.result.then(function () { there I then need to set the passed scope to false. I would just call the scope directly, but I'm trying to make a function which I can use across multiple delete functions, thus trying to pass he scope that needs changing to false.
I was thinking I could just pass the scope through the function.
Thanks!
update According to what @Josep showed me today I was able to make a work around by passing the scope as a string like so
ng-click="clickFunction('scope1')"
and then doing
$scope[passedScope] = false;