angularjs - $timeout.cancel not working -


i trying cancel $timeout in code snippet shown below, doesn't seems working.

            var trial=1;         $scope.trialtimeout = $timeout(countdowntime,0);          function countdowntime(){             $timeout(function(){                 trial++;                 console.log("countdowntime");                 if(trial>2)                     {                         callme();                     }                 countdowntime();             },1000)         }          function callme(){             console.log("this "+$timeout.cancel($scope.trialtimeout));             //$timeout.cancel(trialtimeout);          } 

when log$timout.cancel($scope.trialtimeout) returns false means not cancelling the timeout. $scope.trialtimeout gives promise object still, unable cancel timeout.


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -