离子2中的交叉域错误

时间:2017-05-11 06:22:37

标签: api ionic2 cross-domain



@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
  
})
export class HomePage {
posts:any;

  constructor(public navCtrl: NavController, public http: Http) {
   
   this.navCtrl=navCtrl;
   
   
   this.http.get('API link').map(res => res.json()).subscribe(
    response => {
        this.posts = response.data.resource;
		console.log(this.posts);
    },
    err => {
        console.log("Oops!");
    });
	
	
 }
 
    show(){
	this.navCtrl.push(Nextpage,{
      param1: 'Recent Activities'});
	}
  }




我是离子2的新手,在使用GET方法请求API时遇到跨域错误,我如何允许跨域:true在离子2.附加错误屏幕截图。请建议。

enter image description here

0 个答案:

没有答案