Czołem,
problem polega na tym, że nie potrafię odebrać żadnych danych ze strony:
https://www.metaweather.com/api/
Kiedy to samo robię np. tutaj:
https://jsonplaceholder.typicode.com/
to wszystko ładnie działa.
Dziękuję za każdą wskazówkę.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body ng-app="weatherApp" ng-controller="weatherCtrl">
<div class="block">
<ul>
<li ng-repeat="x in weather">
{{ x.woeid }}
</li>
</ul>
</div>
<script>
var weatherApp = angular.module("weatherApp", []);
weatherApp.controller("weatherCtrl", function ($scope, $http) {
$http.get("https://www.metaweather.com/api/location/search/?query=london")
.then(function success(response) {
$scope.weather = response.data;
}, function err(response) {
$scope.weather = response.data;
console.log("Nie mogę odczytać danych.");
console.log($scope.weather);
});
});
</script>
</body>