fix autorefresh

This commit is contained in:
Martin Geno 2016-07-16 16:12:27 +02:00
parent ed6c96cbae
commit ad88ed54d5
2 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,6 @@ angular.module('ffhb', [
}; };
amMoment.changeLocale('de'); amMoment.changeLocale('de');
$rootScope.globals = $cookieStore.get('globals') || {}; $rootScope.globals = $cookieStore.get('globals') || {};
$rootScope.autorefresh = config.refresh;
if ($rootScope.globals.currentUser) { if ($rootScope.globals.currentUser) {
$http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line
} }

View File

@ -142,7 +142,7 @@ angular.module('ffhb')
}; };
myservice.autorefresh = function(time){ myservice.autorefresh = function(time){
if(autorefresher !== undefined){ if(autorefresher !== undefined){
autorefresher.cancel(); $interval.cancel(autorefresher);
} }
if(time){ if(time){
autorefresher = $interval(function () { autorefresher = $interval(function () {
@ -150,7 +150,8 @@ angular.module('ffhb')
}, time); }, time);
} }
}; };
$rootScope.autorefresh = config.refresh;
myservice.autorefresh($rootScope.autorefresh);
return myservice; return myservice;
}); });