Reputation: 1249
I'm using a FrontApp that loads dependancies and I'm stuck with this error :
Uncaught Error: [$injector:modulerr] Failed to instantiate module moduleApp due to:
Error: [$injector:modulerr] Failed to instantiate module app.module due to:
Error: [$injector:nomod] Module 'app.module' 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.
I probably miss something on my syntax call but can't figure out :/
index.html
<!DOCTYPE html>
<html ng-app="moduleApp">
.....
<script src="app/app.module.js"></script>
<script src="app/module/module.route.js"></script>
<script src="app/module/module.controller.js"></script>
app/app.module.js
(function (angular) {
'use strict';
var moduleApp = angular.module('moduleApp', [
'app.module'
]);
})(angular);
app/module/module.route.js
(function () {
'use strict';
angular
.module('app.module')
.run(appRun);
.....
app/module/module.controller.js
(function (angular) {
'use strict';
angular
.module('app.module')
.controller('ModuleController', ModuleController);
ModuleController.$inject = [...];
Upvotes: 0
Views: 8418
Reputation: 3426
You never create app.module
module.
On app/module/module.route.js
(function () {
'use strict';
angular
.module('app.module', [])
.run(appRun);
.....
And this file should be loaded before the file that contains:
(function (angular) {
'use strict';
var moduleApp = angular.module('moduleApp', [
'app.module'
]);
})(angular);
Or just add on your app/app.module.js file:
(function (angular) {
'use strict';
angular.module('app.module', []);
var moduleApp = angular.module('moduleApp', [
'app.module'
]);
})(angular);
I recommend that you choose meaningful names for your modules, i9t is strange that you have app.module
and appModule
modules.
Upvotes: 3