Reputation: 15
I´m using two components in the same page,https://angular-maps.com and angular2-google-map-auto-complete. https://www.npmjs.com/package/angular2-google-map-auto-complete. I define the angular maps key on this way:
AgmCoreModule.forRoot({
apiKey: 'API_KEY'
})
And for google map automplete on index file:
<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places"></script>
The problem is when I use that components on the same page throws error
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
I know what is the problem but, hoy define single API_KEY to avoid errors
Upvotes: 0
Views: 195
Reputation: 2108
just remove the
<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places"></script>
from your index.html and add your api key inside the amgCoreModule declaration.
Upvotes: 0