angular-ui / angular-google-maps

AngularJS directives for the Google Maps Javascript API
http://angular-ui.github.io/angular-google-maps
2.52k stars 1.07k forks source link

google is not defined! Module 'uiGmapgoogle-maps' is not available! #1855

Open Sepho opened 8 years ago

Sepho commented 8 years ago

Hi guys,

I'm using yeoman to build my site (with this generator: https://github.com/Swiip/generator-gulp-angular ). I've been developing my site with 'gulp serve' and everything is working fine, but when I tried to build the final product, with 'gulp build' and after all scripts were injected and minified, if I try to open my index.html I get this error (see screenshot).

I mean, everything works fine on "dev" proccess (gulp serve), but when I try to get the final version (gulp build) I get this error. I've installed angular-google-maps via bower (with --save flag). I even tried to install angular-simple-logger as a separated package.

Any idea? Thanks in advance and sorry for my broken english!

captura de pantalla 2016-05-19 16 09 36

grtjn commented 8 years ago

We notice that too in our slush-marklogic-node generator. Downgrading to angular-google-maps#2.3.2 solved the issue temporarily. It seems some code was pushed externally, but that is not respecting the async way of loading google?

Sepho commented 8 years ago

I close this issue because it seems that it's a gulp issue. On 'build' task, it minifies all files and loads controller before google-maps js file. I solved it by adding outside all minified files.

VaibhavP17 commented 8 years ago

I am also facing the same issue. And downgrading to angular-google-maps#2.3.2 fixed it. I guess the problem is with the latest version. Can we again re-open the issue and look into it ?

Sepho commented 8 years ago

Sorry, I thought it was a gulp task issue!

pustun commented 8 years ago

I have the same issue. Downgrade to the version 2.3.2 solves the issue.

Rex90 commented 8 years ago

I also have this issue - havent tried downgrading though

brianmtully commented 8 years ago

I have the same issue

Splaktar commented 8 years ago

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.

Note that this issue is a duplicate of #1853.

StepEnquero commented 8 years ago

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.

krushnachandra commented 8 years ago

Same problem am facing how can I resolve this one I have changed #2.3.2 version but still it is not working...any help

noherczeg commented 8 years ago

Broken for us as well in v2.3.4. We are not using gulp.

siddharth8868 commented 8 years ago

Even I faced the same problem and I missed to include these lines in index.html file: <script src='/lib/lodash/dist/lodash.min.js'></script> <script src='lib/angular/angular.min.js'></script> <script src='lib/angular-simple-logger/dist/angular-simple-logger.min.js'></script> <script src='lib/angular-google-maps/dist/angular-google-maps.js'></script>

Note: you need to link them exactly from your libraries, directory structure may vary from project to project.

Also, don't forget to add the this in your css : .angular-google-map-container { height: 400px; }

shirishpickup commented 7 years ago

If you guys are using async defer to load google maps in index.html, remove async and it should work. GoogleMaps are not yet loaded by the time you are accessing it in your component. That was the problem.