我目前正在开发一个从外部API获取的Ionic应用程序。由于这个API也是由我自己开发的,所有东西都是本地的。该API返回一个JSON数组。离子错误获取本地API
我的电流控制器看起来像以下:
app.controller('ListController', ['$scope', '$http', function($scope, $http){
$http.get('http://localhost:8080/api/getPoi/merzouga').success(function(data){
$scope.pois = data;
});
}]);
的问题是,当我尝试这个加载到我的看法,我得到以下错误:
XMLHttpRequest cannot load http://localhost:8080/api/getPoi/merzouga. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
我不知道它是相关的,但Ionic正在服务端口8100和8080上的API。
任何想法,我该如何在本地进行测试?