Make sure we cleanup polling timers on view switch

This commit is contained in:
Johannes Zellner
2019-09-18 18:18:43 +02:00
parent 1621f866a8
commit 23e15581f3
2 changed files with 7 additions and 1 deletions

View File

@@ -770,7 +770,10 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.ready = true;
$interval(function () { refreshApp(); }, 5000); // call with inline function to avoid iteration argument passed see $interval docs
var refreshTimer = $interval(function () { refreshApp(); }, 5000); // call with inline function to avoid iteration argument passed see $interval docs
$scope.$on('$destroy', function () {
$interval.cancel(refreshTimer);
});
});
});
});