0
我尝试将控制器添加到现有模块。但是,我总是得到以下错误消息:重复使用模块来添加控制器?
Uncaught Error: [$injector:nomod] Module 'pmm' is not available! You either misspelled the module name or forgot to load it.
app.js
(function() {
'use strict';
angular.module('pmm', [
'ui.router',
'ui.bootstrap', ...
])
})();
login.js
(function() {
'use strict';
angular
.module('pmm')
.controller('LoginCtrl',LoginCtrl);
function LoginCtrl() {
}
})();
确保app.js在login.js之前注入index.html – Gustav
@Gustav - 对不起,我在编写相同的代码时没有看到您的评论回答。你首先回答 - 如果我们的猜测是正确的,那么*你的*应该被标记为答案:) – Felix
谢谢!他们没有按照正确的顺序。现在它工作正常! – robert