I am trying to get Angular talk to Google Maps Places Autocomplete API. The problem is that the server doesn't allow CORS calls (it doesn't return an Access-Control-Allow-Origin
header) and JSONP calls also seem to be futile as it returns plain JSON and not JSONP, causing a syntax error.
This is what I am currently trying in a service function (_jsonp
is a Jsonp
object):
return this._jsonp.request(url, { method: 'GET' });
And this doesn't work. The response arrives, but Angular crashes because it's not JSONP but JSON.
This is crazy. How on earth can I access this if CORS is disabled and JSONP calls don't work?
https://maps.googleapis.com/maps/api/place/autocomplete/json?key=ACCESS_KEY&types=(cities)&input=ber
Is there a way to convert a JSON server response into a JSONP data object in the Observable pipeline?