const httpOptions = {
headers: new HttpHeaders({ 'Access-Control-Allow-Headers': '*' })
};
return this.http.get<any>('https://maps.googleapis.com/maps/api/geocode/jsonaddress=1600+Amphitheatre+Pa
rkway,+Mountain+View,+CA&key=myapikey',
httpOptions);
当我运行此URL时,我遇到了错误
Access to XMLHttpRequest at 'https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=AIzaSyAFZSWxtOreMcERHby_vD4x_XgVWfamweY' from origin
'http://192.168.4.52:4200' has been blocked by CORS policy:
Request header field access-control-allow-headers is not allowed by Access-Control-Allow-Headers in preflight response.