Question

I'm using angular-google-maps to handle google maps at an angular application. For this, I have to add the angular-google-maps.jsto the project. The page works without any error, if I add the script in the following way:

<script type="text/javascript" 
        src="http://www.directiv.es/application/html/js/nlaplante/angular-google-maps/angular-google-maps.js"></script>

But it will not work, if I use the local copy, like this:

<script type="text/javascript" 
        src="js/libs/directiv.es/angular-google-maps.js"></script>

Looking at firebug, I see the angular-google-maps.js file is loaded, but in this case, the following error occurs:

Uncaught Error: [$injector:modulerr] Failed to instantiate module mapsApp due to:
Error: [$injector:modulerr] Failed to instantiate module google-maps due to:
Error: [$injector:nomod] Module 'google-maps' is not available! You either misspelled the...<omitted>...1) 

Searching the web for hours I did not find any reason or solution. Maybe you have an idea or hint, how to find the reason?

Was it helpful?

Solution

I found the solution and like to write down that here for the case, the someone runs into the same problem.

In my case, I downloaded the angular-google-maps extension from github, extracted that zip-file on windows an copied the file to my project. With the result, that an error occurs: Failed to instantiate module google-maps due to ... while loading "the same" js file over http everything works fine. The point is: it's not the same file!

The solution is to take the file from the URL Link and storing local:

Maybe during downloading or extracting, the zip-file was broken. Maybe there is an character problem. Whatever.

If I open that link http://www.directiv.es/application/html/js/nlaplante/angular-google-maps/angular-google-maps.js in an browser, I can right-click that file and open the source in an "source-code" editor and save that file on disk.

Now I can copy that new created file into my project folder like that location: js/libs/directiv.es/angular-google-maps.js and everything works fine.....

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top