-2
我有工作角这样的代码访问我的node.js REST与本地JSON文件angularjs
App.controller('bodyController', ['$scope','$http',function($scope,$http){
$http.get('data.json').success(function(data){
$scope.data=data;
}).error(function(){
});
}]); 但是对于在浏览器返回一个JSON API的工作似乎没有工作
App.controller('bodyController', ['$scope','$http',function($scope,$http){
$http.get('http://localhost:8090/api/all').success(function(data){
$scope.data=data;
}).error(function(){
});
}]);基于节点的服务器上 URL返回酷似data.json内容http://localhost:8090/api/all
我已签铬的十字起源的事,是不是这里的情况 正在使用Firefox与输出控制台说明OK得到响应
您的图片包括你已经涵盖了一个窗口中的错误消息。这可能是相关的。 – Quentin
尝试使用data.data作为响应发送为{data:{}} –
我现在修复了这个错误,它没有成功从http获取数据,因此转到错误函数。现在我想知道它为什么不成功 –