4

I have a 'maps-services' module with a 'MapService' service as below:

angular.module('maps-services', [])
.service('MapService', [$log, function($log) {
    this.initMap = function() {
    }
    this.updateMap = function() {   
    }
}]);

I also have a 'maps' module depending on 'maps-services' as below:
angular.module('maps', [
   'maps-services'
]);

When I had a dependency on 'maps' in another module, I get an uncaught object error with the message:

"[$injector:nomod] Module 'ngLocale' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.3.0-beta.11/$injector/nomod?p0=ngLocale"

I don't understand what's going on and how I could debug the module loading to understand better where the problem is.

Could you please help me ?

Regards.

user3181983
  • 153
  • 1
  • 4
  • 13

1 Answers1

1

80s compilers' style

This exception message reminds me of error messages 80s compilers used to throw.

Basically when Angular throws:

Module 'ngLocale' is not available!

It means to say:

One of your modules wasn't loaded (but not ngLocale).

See this and this for more info.

Now why wasn't your module loaded, or what module is it, is for you to work out. In my case, having this

angular.module( 'treeDemoApp' )

instead of this

angular.module( 'treeDemoApp', [] )

was enough for Angular to throw this message. But you code clearly has the [].

Chrome Bug?

There are some suggestions (1, 2) that this is due to a bug in chrome.

Community
  • 1
  • 1
Izhaki
  • 23,372
  • 9
  • 69
  • 107