I have a View that updates after 1 minute, I stop the timer after you leave this view, and everything is fine. After returning to the current view, the timer does not restart again.
This is the controller code of this kind:
.controller('IndexCtrl', function($scope, $timeout, RestService) { var updateN = 60*1000; $scope.test = "View 1 - Update"; var update = function update() { timer = $timeout(update, updateN); RestService.getdata(function(data) {; $scope.items = data.slice(0,2); }); }(); $scope.$on('$ionicView.beforeLeave', function(){ $timeout.cancel(timer);
angularjs ionic-framework ionic ionic-view
ingalb
source share