我有这个错误:
Uncaught Error: [$injector:nomod] http://errors.angularjs.org/1.3.15/$injector/nomod?p0=sensorManagement
sensorManagement是我的模块名
你知道上面的错误是什么意思吗?
如果你点击链接,你会看到:
模块'sensorManagement'不可用!你要么拼错了模块名称或忘记加载它。如果注册一个模块,请确保您可以将依赖项指定为第二个参数。
这意味着你没有声明模块,你可以这样修复:
angular.module('sensorManagement', []);
也有可能您遇到了Amo_Geismar回答的问题,并且您多次遇到上述问题(或忘记加载js文件)。
要在声明模块后使用它,可以省略数组。
sensorManagement.module.js
angular.module('sensorManagement', []);
someService.service.js
angular.module('sensorManagement') // Notice the lack of ', []' here
.factory('yourService', function() {
// Code here...
});
可能原因:
1)实际上,您不止一次地创建了同一个模块。我想你可能在你的代码中有很多次这样的地方:
angular.module('sensorManagement',[])
如果你想使用模块do
angular.module('sensorManagement'). //chain whatever controller/filter/service/factory
2)你忘记加载你声明模块的脚本,所以可能在你的index.html中你缺少
<script src="your/modules/sensorManagement.js"/>
包含你的声明:
angular.module('sensorManagement',[])