Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple instances of google-maps-api seem to be causing some conflicts #51

Closed
govis opened this issue Jun 30, 2015 · 3 comments
Closed

Comments

@govis
Copy link

govis commented Jun 30, 2015

Somewhat related to #22

I have a page with multiple components that depend on google maps api - an input with place auto-complete and a map. So I have following tags on my page:


<google-maps-api on-api-load="_initAutocomplete"></google-maps-api>
<google-map latitude="[[latitude]]" longitude="[[longitude]]"></google-map>

The default value for libraries attribute on both google-maps-api and google-map is "places", so it should match. However I am getting the following error spit out in console and _initAutocomplete handler never fires:

k[bd].maps.Load is not a function

And if I take out the map tag the other works as expected. This feels like a common scenario to have some kind of geo-input and a map so I am wondering if it is supported and if so - what am I doing wrong? Thanks.

@ebidel
Copy link
Contributor

ebidel commented Jun 30, 2015

Do you have a working jsbin we can try?

@govis
Copy link
Author

govis commented Jun 30, 2015

I narrowed it down to google-map's language property. I had copied the code from google-map demo page and it had the language set to "en" whereas my google-maps-api tag did not have it set so it defaulted to '' (empty string)

<google-maps-api on-api-load="_initAutocomplete "></google-maps-api>
<google-map latitude="[[latitude]]" longitude="[[longitude]]" language="en"></google-map>

This has caused the scripts to load twice and the error:

<script src="https://maps.gstatic.com/maps-api-v3/api/js/21/5a/main.js"></script>
<script src="https://maps.gstatic.com/maps-api-v3/api/js/21/5a/places.js"></script>
<script src="https://maps.gstatic.com/maps-api-v3/api/js/21/5a/main.js"></script>
<script src="https://maps.gstatic.com/maps-api-v3/api/js/21/5a/places.js"></script>

We can close it as similar to #22 but different property causing the conflict. If you want I can still put a sample together on jsbin, but I am not sure where you guys are hosting the polymer bits on cdn?

Thanks.

@ebidel
Copy link
Contributor

ebidel commented Jun 30, 2015

Cool. Glad you tracked it down.

@ebidel ebidel closed this as completed Jun 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants