Роман Тимохов Asked:2020-12-07 02:51:01 +0000 UTC2020-12-07 02:51:01 +0000 UTC 2020-12-07 02:51:01 +0000 UTC 无法以角度为api请求生成标头 772 控制器写道: app.controller('sportsController', function ($scope, $http) { $http({ method: 'GET', url: 'https://api.pinnacle.com/v2/sports', headers: { 'Authorization': 'Basic UlQ4NDM1NjM6QmV0RGVzayExNw==' } }). success(function (data) { $scope.sports = data.sports; }); }); 但是控制台告诉我: 我究竟做错了什么? ajax 1 个回答 Voted Best Answer Mikhail Malakhvei 2020-04-20T00:53:37Z2020-04-20T00:53:37Z 跨域问题。试试这样: var url = "https://api.pinnacle.com/v2/sports" + "?callback=JSON_CALLBACK"; $http({ contentType: "application/json; charset=utf-8",method: 'jsonp',url:url,headers: {'Content-Type': 'application/x-www-form-urlencoded'}})
跨域问题。试试这样: