【发布时间】:2014-08-05 08:21:57
【问题描述】:
我有一个带有“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"
我不明白发生了什么以及如何调试模块加载以更好地了解问题所在。
你能帮帮我吗?
问候。
【问题讨论】:
-
尝试将$log改成字符串
.service('MapService', ['$log', function($log) { -
奇怪。您是否在视图中的任何位置使用
ng-locale指令? -
我没有在代码中的任何地方使用 ngLocale。
-
你有没有机会找到解决办法?
-
我遇到了同样的问题。仅发生在我的生产服务器(数字海洋和 heroku)上,但在本地不是问题。快把我逼疯了。
标签: angularjs dependency-injection angularjs-module