Angular: 'modulerr', "实例化模块失败
Angular: 'modulerr', "Failed to instantiate module
我正在努力学习Angular,在尝试向我的应用程序中添加路由时遇到了瓶颈。
总是出现这个错误
'modulerr', "实例化模块失败
从其他stackoverflow问题我收集它不是从加载ngRoute正确,但angular-route.js加载在头部,和ngRoute声明在我的模块结构,所以我有点困惑
我的索引文件如下
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/1.1.2/angularfire.min.js"></script>
<script src="js/app.js"></script>
<script src="js/animations.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/services.js"></script>
</head>
<body ng-app="pgpChatApp">
<div class="view-container">
<div ng-view="" class="view-frame"></div>
</div>
</body>
</html>
My app file
'use strict';
var pgpChatApp = angular.module('pgpChatApp', [
'ngRoute',
'firebase',
'pgpChatAnimations',
'pgpChatControllers',
'pgpChatFilters',
'pgpChatServices'
]);
pgpChatApp.config(["$routeProvider", function ($routeProvider) {
$routeProvider.when("/home", {
// the rest is the same for ui-router and ngRoute...
controller: "userAuth",
templateUrl: "partials/home.html"
}).when("/account", {
// the rest is the same for ui-router and ngRoute...
controller: "AccountCtrl",
templateUrl: "partials/msg_room.html",
resolve: {
// controller will not be loaded until $requireAuth resolves
// Auth refers to our $firebaseAuth wrapper in the example above
"currentAuth": ["Auth", function (Auth) {
// $requireAuth returns a promise so the resolve waits for it to complete
// If the promise is rejected, it will throw a $stateChangeError (see above)
return Auth.$requireAuth();
}]
}
});
}]);
我的控制器文件
var pgpChatAppControllers = angular.module('pgpChatAppControllers', []);
pgpChatAppControllers.controller("userAuth", ["$scope", "$routeParams", "Auth",
function ($scope, $routeParams, Auth) {
$scope.createUser = function () {
$scope.message = null;
$scope.error = null;
Auth.$createUser({
email: $scope.email,
password: $scope.password
}).then(function (userData) {
$scope.message = "User created with uid: " + userData.uid;
}).catch(function (error) {
$scope.error = error;
});
};
$scope.removeUser = function () {
$scope.message = null;
$scope.error = null;
Auth.$removeUser({
email: $scope.email,
password: $scope.password
}).then(function () {
$scope.message = "User removed";
}).catch(function (error) {
$scope.error = error;
});
};
}]);
有谁知道修复是什么吗?
Thanks in advanced
[编辑]完整异常消息
http://errors.angularjs.org/1.3.15/$injector/modulerr?p0=pgpChatAnimations&p1=Error: [$injector:nomod] http://errors.angularjs.org/1.3.15/$injector/nomod?p0=pgpChatAnimationsat Error (native)在https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js: 6:417在https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js: 21:412a (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:21:53)在w.bootstrap (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:21:296)在https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js: 35:116At r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:302)At g (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:34:399)在https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js: 35:63At r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:302)"
angular-route的url不能正常工作。尝试使用:
http://code.angularjs.org/1.2.0-rc.3/angular-route.js
我猜我的模块名称仍然不匹配app.js中定义的模块
显示修复
https://github.com/jkirkby91/angular-firebase-chat/commit/35be74592197d16435adb322f0e24963108ed97a- Angular重命名模块后未能实例化模块
- AngularJS出错-无法实例化模块
- 未捕获错误:由于,[$injector:moduler]未能实例化模块polmgr
- 角度错误: [$injector:模块rr] 由于以下原因无法实例化模块角度图表: 错误: [$injector:nom
- 由于以下原因,无法实例化模块 myApp:错误:[$injector:nomod] http://errors.angu
- 未捕获的错误: [$injector:modulerr] 无法实例化模块 toastr
- 无法实例化模块 ng材料
- 无法使用 JSPM 实例化模块 kendo.directives
- 使用 ui-view 导致无法实例化模块 ui.router
- 未捕获的错误: [$injector:modulerr] 由于以下原因,无法实例化模块 myApp: 错误: [$inj
- “由于”在角度和平均堆栈中“无法实例化模块'app'”
- 未捕获错误: [$injector:模块rr] 由于以下原因无法实例化模块启动器:错误: [$injector:模块rr
- Angular:[$injector:modulerr]未能实例化模块
- 未捕获错误:[$injector:moduler]由于以下原因无法实例化模块scheduleApp
- 未能实例化模块[$injector:unp]未知提供程序:$routeProvider
- $state.go无法实例化模块
- Angular--实例化模块失败
- AngularJS:未捕获错误:$injector:modulerr未能实例化模块
- 实例化模块失败错误:[$injector:unpr]
- 未捕获错误:[$injector:modulerr]实例化模块失败,原因是: