Whenever I try to add ng-app="adminApp"
to the body in AngularJS, I always encounter this error. The error occurs during auto bootstrap.
Uncaught Error: [$injector:modulerr] Failed to instantiate module adminApp due to: Error: [$injector:nomod] Module 'adminApp' 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.
If I remove "adminApp" and just use ng-app
, the error disappears but then I can't utilize ngRoute
as it requires an app name. I've searched for solutions to this issue for the past two days but nothing has worked for me yet.
I even tried stripping everything down to just having ng-app
and three elements.
index.html:
window.mainmodule = angular.module('adminApp', ['ngRoute','ngMaterial']);
<!DOCTYPE html>
<html lang="hu">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1" />
</head>
<body ng-app="adminApp">
<div id="loadingscreen">
<div style="left:0;top:0;width:0px;height:20px;background-color:#0000FF;" id="loadingbar"></div>
<div class="center">Loading...</div>
</div>
<script type="text/javascript" src="utils/angular.js"></script>
<script type="text/javascript" src="utils/angular-route.js"></script>
<script type="text/javascript" src="utils/angular-animate.js"></script>
<script type="text/javascript" src="utils/angular-aria.js"></script>
<script type="text/javascript" src="utils/angular-material.js"></script>
<script type="text/javascript" src="utils/require.js" data-main="modules/main"></script>
</body>
</html>
UPDATE: Currently using Angular v1.5.0-rc.0.
Codepen link: http://codepen.io/anon/pen/pgwZLq