diff --git a/js/public/app.js b/js/public/app.js index d7c966d..78e5d80 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -30,6 +30,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil $scope.cityLoadError = ''; $scope.currentCity = null; + $scope.domCity = null; $scope.imageMapper = { "Clear": "sun.png", @@ -41,6 +42,13 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil "Thunderstorm": "thunderstorm.png", } + // Reload weather information each minute + $interval(function () { + if ($scope.currentCity != null) { + $scope.loadCity($scope.domCity); + } + }, 60000); + $timeout(function () { $scope.loadCities(); }); @@ -70,6 +78,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil $http.get(OC.generateUrl('/apps/weather/weather/get?name=' + city.name)). success(function (data, status, headers, config) { if (data != null) { + $scope.domCity = city; $scope.currentCity = data; $scope.currentCity.image = $scope.imageMapper[$scope.currentCity.weather[0].main]; $scope.currentCity.wind.desc = "";