AngularJS. Clear $timeout when invoking angular-ui modal

后端 未结 2 688
北恋
北恋 2020-12-28 11:48

I have several $timeout expressions in Modal controller

App.controller(\'ModalCtrl\', function ($scope, $timeout) {
    for (var i = 0; i < 1         


        
2条回答
  •  眼角桃花
    2020-12-28 12:16

    You may also let them cancel themselves by doing this...

    (function(){
      var timer = $timeout(function(){
        console.log(timer.$$timeoutId);
        $timeout.cancel(timer);
      }, 1000);
    })();
    

提交回复
热议问题