heroin
heroin

Reputation: 2247

Google Maps Javascript API gives INVALID_REQUEST

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).

Upvotes: 3

Views: 1758

Answers (1)

heroin
heroin

Reputation: 2247

After looking more closely in docs, I've found that I used incorrect type. It should be '(cities)' instead of 'cities'.

Upvotes: 2

Related Questions