I am using Google Maps JavaScript API from ionic 2 framework. This code
new google.maps.places.AutocompleteService().getPlacePredictions(
{ input: query, types: ['cities'] },
function (predictions, status) {}
);
gives INVALID_REQUEST as a status and empty predictions. In browser console I could see this URL query:
https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictionsJson?1skha&4sen-US&9scities&15e3&key=my_api_key_is_here&callback=YYYY&token=XXXX
for query=kha.
Official documentation does not helps a lot (because there is no even error status returned).
After looking more closely in docs, I've found that I used incorrect type. It should be '(cities)' instead of 'cities'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With