0

Trying to print data from an API call to one of my views:

{{forecast.list.rain['3h']}}

Making the API call successfully and the data logs in the console.

var urlForecast = "http://api.openweathermap.org/data/2.5/forecast?id=" + 
                  $routeParams.cityId + 
                  "&appid=d436c04d23a5a44329eb8255190a84be&callback=JSON_CALLBACK";

var forecastCall = urlForecast;
var promise2 = $http.jsonp(forecastCall);

promise2.success(function(forecast) {
    $scope.forecast = forecast;
    console.log($scope.forecast);
});

Not printing anything, cant see whats wrong.

9
  • Can you please update the response $scope.forecast in question. Commented Oct 21, 2016 at 6:19
  • update $scope.forecast? Commented Oct 21, 2016 at 6:23
  • I want to see the response you getting in $scope.forecast object Commented Oct 21, 2016 at 6:24
  • from the console? Commented Oct 21, 2016 at 6:25
  • Yes in the console. Commented Oct 21, 2016 at 6:26

1 Answer 1

1

Try using .then instead of .success, because if there's an error, .success method is not firing.

Sign up to request clarification or add additional context in comments.

1 Comment

Not printing anything, can print data from other API calls made in the same way, its just this one for some reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.