question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

You have included the Google Maps API multiple times on this page

See original GitHub issue

I know this issue happened to others but I am pretty stuck with it since days, can’t find any solution.

Here is my @NgModule:

import { NgModule } from '@angular/core';
import { AgmCoreModule } from 'angular2-google-maps/core/index';

// Global vars
import appGlobals = require('./../globals');

@NgModule({
    imports:      [ AgmCoreModule.forRoot({
                        apiKey: appGlobals.googleMapsApiKey
                    }) ],
})

export class JobSearchModule {}

Here is my HTML:

<div class="col-md-12 google-maps-container">
        <sebm-google-map [latitude]="mapLat"
                         [longitude]="mapLng"
                         [mapDraggable]="false"
                         [zoom]="zoom"
                         [zoomControl]="false"
                         [streetViewControl]="false"
                         (mapClick)="mapClicked($event)">
            <sebm-google-map-marker [latitude]="mapLat"
                                    [longitude]="mapLng">

            </sebm-google-map-marker>
        </sebm-google-map>
    </div>

And here is a screenshot of what I have inside my HTML head tag:

screen shot 2016-10-02 at 13 36 15

So it looks like it is really including the API twice but I don’t know why or how.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

39reactions
EddyP23commented, Nov 3, 2016

@escarabin i had similar problem. Try this.

You need to import maps in the root application module, so you do something like this:

@NgModule({
    declarations: [
        ...
    ],
    imports: [
        ...,
        AgmCoreModule.forRoot({
            apiKey: 'some key here'
        })
    ],

But then if you want to use maps in a component that does not belong to this module, go to that module and do this:

@NgModule({
    declarations: [
        SomeComponentThatHasMapsInItsHtml,
        .....
    ],
    imports: [
        AgmCoreModule,
        ...
    ],
3reactions
gerajccommented, Jul 15, 2017

@EddyP23 , What can i do if im using skd autocomplete and agm maps? Since it imports into index <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"> </script>

Read more comments on GitHub >

github_iconTop Results From Across the Web

"You have included the Google Maps API multiple times on ...
I'm getting the error "You have included the Google Maps API multiple times on this page. This may cause unexpected errors." I know...
Read more >
You have included the Google Maps JavaScript API multiple ...
Got a problem with this You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors...
Read more >
You have included the Google Maps API multiple times on this ...
Hi there, Need help to debug: "You have included the Google Maps API multiple times on this page. This may cause unexpected errors....
Read more >
You have included the Google Maps API multiple times on this ...
Make sure you only load the Google Maps API once which from Super Store Finder plugin which has calls to specific libraries and...
Read more >
included the Google Maps JavaScript API multiple times
The location map doesn't show up, and in the console i see the error message “You have included the Google Maps JavaScript API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found