javascript - Variable on scope doesn't keep the value changed in a function -
i have controller initializes value such:
$scope.showthing=true;
i toggle value ng-click like
ng-click="showthing=!showthing"
which works ok if try using same value in function inside controller behaves irrational, least. simple alerting value in interval function gets right value first time iterates after changing value, not that. since it's trivial wouldn't want create factory alone, hope there's can tell me doing wrong here.
your question not straightforward, can post code. here hoisting issue.
var = 10; console.log("value of 'a' before hoisting: "+a); (function(){ console.log("value of 'a' after hoisting: "+a); var a; })(); result: value of 'a' before hoisting: 10 value of 'a' after hoisting: undefined