AngularJS加载模块失败
AngularJS is failing to load module
首先介绍我的环境。我使用的是Windows7、StS IDE和关键的tc服务器谷歌Chrome。
我建立了一个angularJS应用程序。下面是我的index.jsp 的代码
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My AngularJS App</title>
<script src="<c:url value="resources/js/angular.min.js"/>"></script>
<script src="<c:url value="resources/js/angular-route.min.js"/>"></script>
<script src="<c:url value="resources/js/angular-resource.min.js"/>"></script>
<script src="<c:url value="resources/js/bootstrap.min.js"/>"></script>
<script src="<c:url value="app/view1/FormView.js"/>"></script>
<script src="<c:url value="app/view1/controller.js"/>"></script>
<script src="<c:url value="app/view1/services.js"/>"></script>
<script src="<c:url value="app/view2/Form2View.js"/>"></script>
<script src="<c:url value="app/view2/controller.js"/>"></script>
<script src="<c:url value="app/view2/service.js"/>"></script>
<script src="<c:url value="app/js/bootstrap.min.js"/>"></script>
<script src="<c:url value="app/myApp.js"/>"></script>
<link rel="stylesheet" href="<c:url value ="resources/css/bootstrap.min.css"/>">
<link rel="stylesheet" href="<c:url value ="app/view1/app.css"/>">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body data-ng-app= "myApp">
<ul class="menu">
<li><a href="#/view1">LookUpCodeStyle</a></li>
<li><a href="#/view2">AccountMaster</a></li>
</ul>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div data-ng-view></div>
<!-- In production use:
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
-->
</body>
</html>
当部署在服务器上时,它会抛出以下错误:
Uncaught TypeError: undefined is not a function
Uncaught TypeError: undefined is not a function
Uncaught TypeError: undefined is not a function
Uncaught TypeError: undefined is not a function
Uncaught Error: No module: ngResource
但我定义的最大的东西:
<body data-ng-app= "myApp">
eclipse抛出一个错误:
Cannot find module with name myApp.
我有myApp.js:
angular.module('myApp', [
'ngRoute',
'myApp.form',
'myApp.form2'
]).
config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
顺便说一句,它正在加载所有的文件。我登记了网络。如果有任何帮助,我们将不胜感激?
尝试将ngResource添加到myApp模块中。
angular.module('myApp', [
'ngRoute',
'ngResource',
'myApp.form',
'myApp.form2'
])
我在Eclipse的AngularJS中遇到了同样的问题:Cannot find module with name MyApp
,尽管MyApp
已在Angular Explorer中列出。一种解决方法是从MyApp
声明中取消捕获config
,如下所示:
var app = angular.module('myApp', [
'ngRoute',
'myApp.form',
'myApp.form2'
]);
app.config(['$routeProvider', function($routeProvider) {
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
相关文章:
- 意外的令牌模块生成失败:SyntaxError
- 使用Q节点模块时,Bluemix node.js应用程序部署失败
- webpack配置警告和错误:;模块解析失败”;
- 添加角光栅时模块实例化失败
- 导入模块失败's css文件
- 模块构建失败:引用错误:[BABEL] 未知选项:base.stage
- webpack 解析模块 'blueimp-load-image' 失败
- Webpack 模块构建失败意外令牌(rails react build)
- 命令失败: gm 识别: 无法打开文件 (2) [没有这样的文件或目录].通用模块和 ES6 承诺的问题
- AngularJS 依赖注入在模块中失败
- AngularJS加载模块失败
- 角度模块加载失败
- Gulp.js安装失败,找不到模块'fetch.js'
- Angular--实例化模块失败
- 为什么当子模块构建失败时,NPM会成功
- 实例化模块失败错误:[$injector:unpr]
- 实例化app模块失败.处理步骤为什么
- 未捕获错误:[$injector:modulerr]实例化模块失败,原因是:
- Grunt失败,提示“无法找到模块”.对于本地模块
- Angularjs、Typescript、Uglify实例化myApp模块失败未知提供商:a