在Ionic2应用程序中 尝试使用http.get接收json,当使用https://randomuser.me/api/?results=10 public api进行尝试时效果很好 但尝试使用ios sumulator时会出现以下错误 如果我将json从我的服务器放在项目的www文件夹中,但如果我将它放在服务器上http.get不起作用
console.error:EXCEPTION:响应状态:0表示URL:null
您认为该方法是否正确
this.http.get('https://randomuser.me/api/?results=10')
.map(res => res.json())
.subscribe(data => {
console.log('before...Hello PeopleService Provider:subscribe');
console.log(data.TripList.Trip);
this.data1 = data.TripList.Trip;
resolve(this.data1);
});