【发布时间】:2014-11-13 07:15:46
【问题描述】:
getjson.controller('controller', function($scope, $http){
var url = "http://api.8coupons.com/v1/getsubcategory";
$http.get(url).success(function(data, status, headers, config){
$scope.jsondata = data;
console.log(data);
}).error(function(data, status, headers, config){});
});
(编者注:在外部函数体中添加了一个右大括号。)
这段代码给了我以下错误:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://www.api.8coupons.com/v1/getsubcategory. This can be fixed by moving the resource to the same domain or enabling CORS.
谁能告诉我哪里出了问题,我该如何解决这个问题?
【问题讨论】:
标签: angularjs angularjs-scope angularjs-ng-repeat angular-ui angular-ui-router