将公共数据用于动态数据

时间:2017-02-09 10:10:27

标签: angularjs chart.js angular-chart

您好我正在尝试使用Google公共数据构建使用angular和chartjs的演示图表。我在控制器内部创建了一个http请求,并尝试在控制台中查看获取的数据,以便查看可用的数据。但我得到一个错误$http.get(...).success is not a function,它是什么意思以及如何克服这个并显示数据。我也得到XHR finished loading: GET这是什么意思? 。谢谢:))

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);
})

1 个答案:

答案 0 :(得分:1)

如果您使用Angular 1.6+,.success has been removed (it has been deprecated since 1.5)。请改用.then

$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);
})
相关问题