Angular 如何将我的http调用修改为本机ionic v3 http调用?
请有人能帮助我,我在爱奥尼亚有一个供应商:Angular 如何将我的http调用修改为本机ionic v3 http调用?,angular,google-maps,http,ionic-framework,Angular,Google Maps,Http,Ionic Framework,请有人能帮助我,我在爱奥尼亚有一个供应商: constructor(public http: HttpClient) { } getNearbyplaces(geo:any){ // console.log("geo",geo) return this.http.get('https://maps.googleapis.com/maps/api/place/nearbysearch/json?location='+geo+'&radius=50&
constructor(public http: HttpClient) {
}
getNearbyplaces(geo:any){
// console.log("geo",geo)
return this.http.get('https://maps.googleapis.com/maps/api/place/nearbysearch/json?location='+geo+'&radius=50&key=MY_API_KEY')
.map(res => res );
}
现在,当我在android设备上运行我的应用程序时,我面临CORS问题,然后我读到一个避免这种情况的好方法是使用本机HTTP调用,但它的语法不同,我不理解它
下面是我的module.ts代码片段,我在其中调用我的提供程序的功能:
getNearbylocation(){
this.locationProvider.getNearbyplaces(this.latitude + "," + this.longitude).subscribe(
locationList=>{
this.nearByList = locationList["results"];
console.log("Printing map"); //to check api hc
this.loadMap()
this.loading.dismissAll();
},err =>{
console.log("error in map");
this.loading.dismissAll();
},
() =>{
})
}
您能解释一下如何将我的代码从http调用更改为http本机调用吗?多谢各位
我已经读了一些答案,但没有一个符合我的需要。我是爱奥尼亚的初学者,任何帮助都将不胜感激