angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

Async loading and google global error.

Open xavhan opened this issue 8 years ago • 31 comments

Since I upgraded to 2.3.3 I got 4 errors at loading time.

Uncaught ReferenceError: google is not defined @ markerwithlabel.js:71
Uncaught ReferenceError: google is not defined @ infobox.js:116
Uncaught ReferenceError: google is not defined @ keydragzoom.js:820
Uncaught ReferenceError: google is not defined @ richmarker.js:60 

It seems to be caused by the async loading of the google maps API. I saw that https://github.com/angular-ui/angular-google-maps/blob/cb667cb7b55a607929537a2fd8250613e38e9be3/spec/coffee/bootstrap/google-api-mock.coffee#L484 try to mock those but it isn't working.

Bonus : Goal of making those lib dependencies is, I think, to make them optional. Is it doable today?

xavhan avatar May 17 '16 09:05 xavhan

I'm getting the same problem - and my elements no longer display.

marcschregardus avatar May 18 '16 11:05 marcschregardus

If there is no way to fix this ATM, can someone tell me which is the latest stable version without that problem?

kdkade avatar May 19 '16 05:05 kdkade

@kdkade We fixated our version to 2.3.2 for now which restored functionality

Qwerios avatar May 19 '16 07:05 Qwerios

I am receiving the same problem. Why were these additional dependencies required?

nebulr avatar May 19 '16 21:05 nebulr

@Qwerios Thanks, did the same and I confirm it solves the issue.

kdkade avatar May 20 '16 05:05 kdkade

same here.. thanks @Qwerios lets wait the fix for v2.3.3 :fries:

lfreneda avatar May 27 '16 23:05 lfreneda

Same error here on version 2.3.3. Downgraded to 2.3.2 and everything works great.

willcrisis avatar May 30 '16 16:05 willcrisis

Same here, but i get the error even in 2.3.2

holaontiveros avatar Jun 02 '16 16:06 holaontiveros

I had the same problem with latest update for google maps.

But after downgrading to 2.3.2 it works fine now.

jatinwaichal avatar Jun 09 '16 22:06 jatinwaichal

After clone project in my github, i'm getting same problem on version 2.3.2

heoheoyh avatar Jun 10 '16 03:06 heoheoyh

2.3.2 is working ok for me D:

@heoheoyh have u tried cleaning bower/npm cache or simply rm -rf bower_components/ ?

lfreneda avatar Jun 10 '16 14:06 lfreneda

@lfreneda it was my mistake..! my version was 2.3.3 and I had reinstalled exactly 2.3.2 version. It is ended up working!

heoheoyh avatar Jun 11 '16 07:06 heoheoyh

I also have the issue, but maybe I can add that I'm using bower with main-bower-files, if it can help.

As everyone, works fine in 2.3.2. Any news?

sinedied avatar Jun 15 '16 18:06 sinedied

I couldn't downgrade because 2.3.2 has broken cluster images which my site depends on. I was able to hack it for now by adding the script tag into the index.html without async defer:

    <!-- Hack to fix exceptions caused by latest version of angular-google-maps -->
    <script src="https://maps.googleapis.com/maps/api/js"></script>

This probably isn't a good thing in the long run, especially loading it without an API key, but it got my site back up and running tonight. I tried to look at making a fix to the library itself, but I have no interest in dealing with CoffeeScript.

Splaktar avatar Jun 16 '16 02:06 Splaktar

@Splaktar 's workaround was awesome except it wouldn't work with mocha... Downgrading to 2.3.2 was the only thing that allowed unit tests to pass.

doc82 avatar Jul 15 '16 19:07 doc82

The problem lies in this commit I believe https://github.com/angular-ui/angular-google-maps/commit/cb667cb7b55a607929537a2fd8250613e38e9be3#diff-0a08a7565aba4405282251491979bb6b - https://github.com/angular-ui/angular-google-maps/blob/cb667cb7b55a607929537a2fd8250613e38e9be3/bower.json

Those 4 new dependencies are looking for 'google' to be defined, however the maps api is loaded until after...using the async loader

joshuawoodward avatar Jul 18 '16 21:07 joshuawoodward

Hi, even after downgrading to 2.3.2, its not working. Please check this plunker - http://plnkr.co/edit/AJpJxBHF1SpwCtRKEzPF?p=preview

I have changed the angular-google-maps to v2.3.2.

Please let me know if you are able to resolve this. Thanks.

StepEnquero avatar Jul 27 '16 19:07 StepEnquero

Is anyone looking into this issue? This is problematic for production projects, please at least revert the latest nam package to be the 2.3.2 (working) version, to avoid issues.

sinedied avatar Jul 27 '16 20:07 sinedied

Add the tag - and it shouldn't break

StepEnquero avatar Jul 27 '16 20:07 StepEnquero

Thanks, works after downgrading to 2.3.2!

ziarno avatar Sep 28 '16 12:09 ziarno

Same problem in 2.4.0. I had to downgrade into 2.3.2 as suggested by many of you. Thanks.

MadJlzz avatar Oct 12 '16 21:10 MadJlzz

Same here, when using 2.4.0 I get the google not defined error. 2.3.2 works fine!

Fonta avatar Oct 15 '16 15:10 Fonta

downgrading to 2.3.2 resolved this issue for me as well.

OR13 avatar Oct 19 '16 15:10 OR13

I got the same issue on version 2.4.0 but downgraded again to 2.3.2, and worked again.

But I noticed something, when I downgraded the version, and I run the bower prune command:

bower prune bower uninstall google-maps-utility-library-v3-infobox bower uninstall google-maps-utility-library-v3-keydragzoom bower uninstall google-maps-utility-library-v3-markerwithlabel bower uninstall js-rich-marker bower uninstall markerclustererplus

Why? I think those files involved with issue somehow.

almothafar avatar Dec 25 '16 11:12 almothafar

Same here.

The furthest version which work for me is version 2.3.2. Anything above that it just crashes with the error. Anyone has any luck with it?

SamuelToh avatar Feb 24 '17 01:02 SamuelToh

Same here, when using 2.4.1 I get the google not defined error. 2.3.2 works fine!

woyehenni avatar Mar 29 '17 08:03 woyehenni

The same issue. For me it happens because of automatic injection of dependencies. I guess markerwithlabel.js, infobox.js, keydragzoom.js and richmarker.js try to call google api after angular-google-maps adds api script on page. So it is just my supposition, but I hope I can help to investigate this.

elensky avatar May 26 '17 16:05 elensky

Downgrading to 2.3.2 works for me as well

shinusuresh avatar Aug 12 '17 11:08 shinusuresh

Hi, had the same problem with 2.4.1 version.

Seems I found solution by overriding dependency in bower.json that works for me:

"overrides": {
    "angular-google-maps": {
      "dependencies": {
        "angular": "1.5.8",
        "angular-simple-logger": "0.1.7"
      }
    }
}

Please note that angular-simple-logger is still required

olexam avatar Aug 28 '17 23:08 olexam

perfect, works for me @olexam

marciobrst avatar Feb 02 '18 20:02 marciobrst