0

Hi I'm trying to use the google public data for building a demo chart using angular and chartjs. I have created a http request inside the controller and trying to view the fetched data in the console, in-order to see what data are available. But Im getting an error $http.get(...).success is not a function,What does it mean and how to overcome this and display the data. Also Im getting XHR finished loading: GET what does it mean ? . Thank you :)

Link to sample data !!!

myApp.controller('chartController',function($scope,$http){
    $http.get("https://www.google.com/publicdata/explore?ds=z8o7pt6rd5uqa6_&ctype=l&strail=false&bcs=d&nselm=h&met_y=unemployment&fdim_y=age_group:y_lt25&fdim_y=seasonality:sa&scale_y=lin&ind_y=false&rdim=country_group&idim=country_group:non-eu&idim=country:de&ifdim=country_group&ind=false&icfg")
    .success(function(data,response){
    console.log(data);
})
Rudhra
  • 123
  • 5
  • 18

1 Answers1

1

If you use Angular 1.6+, .success has been removed (it has been deprecated since 1.5). Use .then instead:

$http.get("https://www.google.com/publicdata/explore?ds=z8o7pt6rd5uqa6_&ctype=l&strail=false&bcs=d&nselm=h&met_y=unemployment&fdim_y=age_group:y_lt25&fdim_y=seasonality:sa&scale_y=lin&ind_y=false&rdim=country_group&idim=country_group:non-eu&idim=country:de&ifdim=country_group&ind=false&icfg")
.then(function(response){
    console.log(response.data);
})
Community
  • 1
  • 1
LionC
  • 3,106
  • 1
  • 22
  • 31