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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -