的$http.get()
工作正常。
有以下错误:
app.controller('ExampleCtrl', [$scope, $http, function ($scope, $http){
应该
app.controller('ExampleCtrl', ['$scope', '$http', function ($scope, $http){
和你的JSON不包含data
道具所以更改$scope.exampleData = response.data;
这个$scope.exampleData = response;
也
var colorArray = ['#000000', '#660000', '#CC0000', '#FF6666', '#FF3333', '#FF6666', '#FFE6E6'];
$scope.colorFunction = function(){
return function(d, i){
return colorArray[i];
};
}
需要在控制器;你得到$范围是不确定的,如果它不是
编辑
PSL是正确的,有在对象没有data
支柱,但仍然是原来的plnkr它有错误。 get()
工作得很好,这回答了OP的问题。
你的响应对象中有属性'data'吗?如果不是,它只是'$ scope.exampleData = response' – PSL