3

I'm using http://angular-google-maps.org/ in my project.

The steps to add to my project are those: http://angular-google-maps.org/use.

When I run my project, browser says:

Uncaught Error: [$injector:modulerr] Failed to instantiate module BeLiga due to:
Error: [$injector:modulerr] Failed to instantiate module BeLiga.ligaControllers due to:
Error: [$injector:modulerr] Failed to instantiate module google-map due to:
Err...<omitted>...1) 

The problem comes when I write:

var moduloMap = angular.module('myController', ['google-maps']);

I've checked everything and can not find the problem.

Ty!

2 Answers 2

2

The problem was the load order of scripts:

Example not running:

 <script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language=en"></script> 
    <script src="lib/angular/underscore.js"></script>
    <script src="lib/angular/angular-google-maps.min.js"></script>

<script src="lib/angular/angular.js"></script>
    <script src="lib/angular/angular-route.js"></script>
    <script src="lib/angular/angular-sanitize.min.js"></script>
    <script src="lib/angular/angular-animate.js"></script>
    <script src="js/app.js"></script>
    <script src="js/services.js"></script>
 <script src="js/animations.js"></script>

Example running:

    <script src="lib/angular/angular.js"></script>
        <script src="lib/angular/angular-route.js"></script>
        <script src="lib/angular/angular-sanitize.min.js"></script>
        <script src="lib/angular/angular-animate.js"></script>
        <script src="js/app.js"></script>
        <script src="js/services.js"></script>
     <script src="js/animations.js"></script>

 <script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;language=en"></script> 
        <script src="lib/angular/underscore.js"></script>
        <script src="lib/angular/angular-google-maps.min.js"></script>

As you can see, the problem was the order of the scripts was a silly error but I did not realize and made me lose a lot of time.

If anyone can serve him, I leave the answer.

A greeting and thanks.

Sign up to request clarification or add additional context in comments.

Comments

1

I finally got mine fixed by ensuring

    <script src='//maps.googleapis.com/maps/api/js?sensor=false'></script>

Goes above other google scripts. I am using rails so I have it placed above my rails tags:

    <%= stylesheet_link_tag    'application', media: 'all' %>
    <%= javascript_include_tag 'application' %>
    <%= csrf_meta_tags %>

Refer to this post which might give more information. Hope this helps!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.