google-maps-loader icon indicating copy to clipboard operation
google-maps-loader copied to clipboard

country autocomplete

Open mossa-Sammer opened this issue 4 years ago • 1 comments

from google APIS doc

 const autocomplete = new google.maps.places.Autocomplete(input);
  // Set initial restrict to the greater list of countries.
  autocomplete.setComponentRestrictions({
    country: ["us", "pr", "vi", "gu", "mp"],
  });

when I try this it gives me undefined for the places the Error

Uncaught (in promise) TypeError: Cannot read property 'Autocomplete' of undefined
    at GoogleMapsScriptLoader

mossa-Sammer avatar Oct 15 '20 10:10 mossa-Sammer

Hello, did you include the places library?

const loader = new Loader('my-api-key', {
  libraries: ['places'],
});

davidkudera avatar Oct 22 '20 10:10 davidkudera