From d359a86e9f73cb1528363dc50370cf60ff6a3a0e Mon Sep 17 00:00:00 2001 From: imp4ct Date: Wed, 29 Jul 2020 23:35:46 -0400 Subject: [PATCH] Added loading --- index.html | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 73297fe..fbd7dfa 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@

{{weather.current.temp}}°C

-

{{weather.current.weather[0].main}}

+

{{weather.current.weather[0].main}}{{loading}}

@@ -38,10 +38,10 @@
@@ -53,6 +53,7 @@ app.controller('body', function($scope, $http) { //Some sort of async function so location is got before the script called $scope.weather = 0 + $scope.loading = 'Loading...' // $scope.weather.current.temp = 1; navigator.geolocation.getCurrentPosition((position) => { $scope.loaddata(position.coords.latitude, position.coords.longitude) @@ -64,6 +65,7 @@ $scope.loaddata = function(lat, lon) { $http.get("https://api.openweathermap.org/data/2.5/onecall?lat=" + lat + "&lon=" + lon + "&units=metric&appid=5292f0a17ecbe4b523fe0609ed2c556f").then(function (response) { $scope.weather = response.data; + $scope.loading = '' $scope.lat = lat; $scope.lon = lon; })