From ad88ed54d5cef5fae959936e623700ce8dc039f2 Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Sat, 16 Jul 2016 16:12:27 +0200 Subject: [PATCH] fix autorefresh --- public/app/app.js | 1 - public/components/store.js | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/app.js b/public/app/app.js index 064ae6d..4c0eaf6 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -24,7 +24,6 @@ angular.module('ffhb', [ }; amMoment.changeLocale('de'); $rootScope.globals = $cookieStore.get('globals') || {}; - $rootScope.autorefresh = config.refresh; if ($rootScope.globals.currentUser) { $http.defaults.headers.common['Authorization'] = 'Basic ' + $rootScope.globals.currentUser.authdata; // jshint ignore:line } diff --git a/public/components/store.js b/public/components/store.js index e5548bf..4a620d4 100644 --- a/public/components/store.js +++ b/public/components/store.js @@ -142,7 +142,7 @@ angular.module('ffhb') }; myservice.autorefresh = function(time){ if(autorefresher !== undefined){ - autorefresher.cancel(); + $interval.cancel(autorefresher); } if(time){ autorefresher = $interval(function () { @@ -150,7 +150,8 @@ angular.module('ffhb') }, time); } }; - + $rootScope.autorefresh = config.refresh; + myservice.autorefresh($rootScope.autorefresh); return myservice; });