Could someone please explain why I am encountering the following issue:
I am making a typical API call in my controller using the Angular resource directive.
$scope.weatherAPI = $resource('http://api.openweathermap.org/data/2.5/forecast/daily', {callback: 'JSON_CALLBACK'}, {get: {method: 'JSONP'}});
$scope.weatherResult = $scope.weatherAPI.get({ q: $scope.city, cnt: 4, APPID: 'xxxxxx' });
After receiving the results, I attempt to log them in the console.
console.log($scope.weatherResult);
console.log($scope.weatherResult.city)
console.log("scope weatherResult " + $scope.weatherResult);
console.log("scope weatherResult.list: " + $scope.weatherResult.list);
console.log("scope weatherResult.city: " + $scope.weatherResult.city);
However, despite the objects being present in $scope.weatherResult
, when trying to access its properties they show as undefined
, preventing me from utilizing that data effectively.