Reputation: 53
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!
Upvotes: 3
Views: 3265
Reputation: 53
The problem was the load order of scripts:
Example not running:
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&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&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.
Upvotes: 2
Reputation: 43
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!
Upvotes: 1