I am facing an issue with a scope variable that I passed to a function. Even though the variable is accessible inside the function, its value does not change when I try to modify it.
Below is my HTML code:
<div class="console_item" ng-class="dropdwns.assetshow==true?'showdrp':'hidedrp'" ng-
click="drpdwn(dropdwns.assetshow)">Asset Type</div>
And here is the code in my controller:
$scope.dropdwns={assetshow:false};
$scope.drpdwn=function(dat){
if(dat==true)
{
dat=false;
}
else
{
dat=true;
}
console.log($scope.dropdwns);
}
I have tried using $apply, but it gives me an error. Can someone please assist me? Thank you.