1

I have the following code to display a progressbar:

var cancelTimeoutProcess = $timeout(function () {
                    if (defer !== null) {
                        vm.setProcessingParameters('No Message');
                        defer = vm.openProgressBar();
                        deferTimer.resolve();
                    }
                }, 1000);
                
            // cancel the $timeout service 
            $scope.$on('$destroy', function () {
                if (cancelTimeoutProcess) {
                    $timeout.cancel(cancelTimeoutProcess);
                    cancelTimeoutProcess = null;
                }
            });

Wanted to confirm if this is the right way to launch a progressbar and destroy the timeout?

Smitha
  • 6,110
  • 24
  • 90
  • 161
  • Possible duplicate of http://stackoverflow.com/questions/26983696/angularjs-does-destroy-remove-event-listeners – mindparse Jan 20 '16 at 08:18

0 Answers0