lukemadera / meteor-autoform-googleplace

Google Places Autocomplete input (without map). Returns an object with formatted address components
21 stars 19 forks source link

Uncaught ReferenceError: google is not defined #25

Open patrickbolle opened 8 years ago

patrickbolle commented 8 years ago

Looks like it is on this line - this.autocompleteservice =new google.maps.places.AutocompleteService();

I'm not sure if I'm just not loading google places properly (have it in my head tag of the navbar), or if I'm doing something else wrong.

Thanks a lot!!

ptrmrrs commented 8 years ago

You might have some kind of race condition where meteor tries to render the field before the API has loaded. If you're using the dburles:google-maps package you can use the reactive method GoogleMaps.loaded() in a helper to only render the form field if it returns true.

patrickbolle commented 8 years ago

I'll give it a shot! Thanks @yetanotherpete

acomito commented 8 years ago

I set up a global helper that uses the GoogleMaps.loaded(), then I do a trigger on enter with FlowRouter. I wrap the google input in a #if dependent on the googlemapsisready helper that comes with dburles package.