I’m very new to AngularJS and I’m trying to make a weather app just for practice.
as weather service i use: https://openweathermap.org. my http request does not work, here’s my code:
angular.module("weather", []).controller('WeatherController', function($scope,$http){
$scope.getWeather = function() {
$http.get('https://api.openweathermap.org/data/2.5/weather?q=London&appid=69f76656f3a6e0a34db5e6052e851f76', config).then(function successCallback(response){
console.log(response);
}, function errorCallback() {
console.log('error');
})
}
});
<div class="n-p-b" ng-app="weather" ng-controller="WeatherController">
<button ng-click="getWeather()">click</button>
<img src="png/righr-arrow .png" class="arrow-right">
<div class="card" style="width: 50rem; height: 35rem; border-radius: 5%; box-shadow: 0 0 2rem rgba(0, 0, 255, 0.1);">
<img src="img/blue.png" class="card-img-top" alt="...">
<div class="card-body" style="padding: 0%;">
<div class="b-card">
<div class="twitter">
<p>Twitter Feed</p>
</div>
<div class="weather-week">
<p>mon</p>
<p>tue</p>
<p>wed</p>
<p>thu</p>
<p>fri</p>
<p>sat</p>
<p>sun</p>
</div>
</div>
</div>
</div>
<img src="png/left-arrow.png" class="arrow-left">
</div>
I tried to use different forms of requests(shortcut etc),different links, but it does not work