我有一个.wep API服务,它工作正常。当我想从Angularjs App.browser控制台获取数据时,给了我这个错误。Angular 2 Rest服务请求
getCurrentFeed() :Observable<Tweet[]>{
return this.http.get('http://localhost:6010/GetTweets').map((resp :Response)=>{
console.log(resp.json());
var fetchedTweets=[];
for(let tweet of resp.json().data)
{
fetchedTweets.push(this.getTweetFromJson(tweet));
}
return fetchedTweets as Array<Tweet>;
});
}
XMLHttpRequest无法加载http://localhost:6010/GetTweets。请求的资源上没有“Access-Control-Allow-Origin”标题。因此不允许访问原产地'http://localhost:4200'。 error_handler.js:54 EXCEPTION:状态响应:0表示URL:null
我该如何在这里应用标题 –