Daniel Thompson
Daniel Thompson

Reputation: 2351

Ember.js prevent Google Maps API from loading multiple times

Working with two separate Google maps addons ember-g-map and ember-place-autocomplete which causes this error:

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

Makes sense, since my index.html page now has multiple scripts loaded in.

Anyone know how Ember devs normally deal with this kind of problem?

Upvotes: 0

Views: 183

Answers (1)

steveszc
steveszc

Reputation: 46

Ideally the addon author should provide a config option to allow the consumer to include or exclude the Google Maps library. I just submitted a PR to ember-place-autocomplete that does just that. Once the PR gets merged you can use that, or use my forked version.

As an alternative to ember-g-map you might consider using ember-leaflet with the ember-leaflet-google-tile-layer addon. Ember-leaflet seems to be the main mapping addon for Ember and it does give the option to exclude the Google maps library.

Upvotes: 2

Related Questions