我試圖使用ui-router創建一個角度應用程序。Angular - 未找到模塊
在HTML文件中我有這樣的身體元素:
<div class="container" ng-app="ang">
<header ng-include="'templates/head.html'"></header>
<div ui-view></div>
<footer ng-include="'templates/foot.html'"></footer>
</div>
<script src="Dependencies/jquery-1.11.3.min.js"></script>
<script src="Dependencies/angular-ui-router.min.js"></script>
<script src="Dependencies/angular.js"></script>
<script src="js/ang.js"></script>
在該模塊中,我有這樣的:
angular.module('ang', ['ui-router'])
而Chrome給我出這個錯誤:
Uncaught TypeError: Cannot read property 'isDefined' of undefined(anonymous function) @ angular-ui-router.min.js:7(anonymous function) @ angular-ui-router.min.js:7
angular.js:80 Uncaught Error: [$injector:modulerr] Failed to instantiate module ang due to:
Error: [$injector:nomod] Module 'ang' 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.
http://errors.angularjs.org/1.3.0/$injector/nomod?p0=ang
at REGEX_STRING_REGEXP (file:///home/user/Desktop/ang/Dependencies/angular.js:80:12)
at file:///home/user/Desktop/ang/Dependencies/angular.js:1797:17
at ensure (file:///home/user/Desktop/ang/Dependencies/angular.js:1721:38)
at module (file:///home/user/Desktop/ang/Dependencies/angular.js:1795:14)
at file:///home/user/Desktop/ang/Dependencies/angular.js:4064:22
at forEach (file:///home/user/Desktop/ang/Dependencies/angular.js:335:20)
at loadModules (file:///home/user/Desktop/ang/Dependencies/angular.js:4048:5)
at createInjector (file:///home/user/Desktop/ang/Dependencies/angular.js:3974:11)
at doBootstrap (file:///home/user/Desktop/ang/Dependencies/angular.js:1484:20)
at bootstrap (file:///home/user/Desktop/ang/Dependencies/angular.js:1505:12)
http://errors.angularjs.org/1.3.0/$injector/modulerr?p0=ang&p1=Error%3A%20%…F%2F%2Fhome%2Fuser%2FDesktop%2Fang%2FDependencies%2Fangular.js%3A1505%3A12)
我該如何解決這個問題?
仍不能解決問題,它給了同樣的錯誤,只需用另一個名字 – John
@約翰,更改文件的順序,負載'angular.js'前'角度-UI-router.min .j' – Satpal
非常感謝!你的答案非常有用,可能爲我節省了很多時間。 – John