4

我有一个带有“MapService”服务的“maps-services”模块,如下所示:

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'
]);

当我依赖另一个模块中的“地图”时,我收到一个未捕获的对象错误消息:

“[$injector:nomod] 模块 'ngLocale' 不可用!您拼错了模块名称或忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数 。http://errors.angularjs。 org/1.3.0-beta.11/ $injector/nomod?p0=ngLocale"

我不明白发生了什么以及如何调试模块加载以更好地了解问题所在。

请你帮助我好吗 ?

问候。

4

1 回答 1

1

80 年代编译器风格

这个异常消息让我想起了 80 年代编译器用来抛出的错误消息。

基本上当Angular抛出时:

模块“ngLocale”不可用!

意思是说:

您的模块之一未加载(但未加载 ngLocale)。

有关更多信息,请参阅

现在,为什么没有加载您的模块,或者它是什么模块,由您来解决。就我而言,有这个

angular.module( 'treeDemoApp' )

而不是这个

angular.module( 'treeDemoApp', [] )

足以让 Angular 抛出这个消息。但是您的代码显然具有[].

铬错误?

有一些建议(1 , 2)这是由于 chrome 中的错误。

于 2014-07-29T23:11:46.417 回答