html<!DOCTYPE html>
<html lang="en" ng-app="routerApp">
<head>
<meta charset="utf-8" />
<meta name="renderer" content="webkit">
<title>首页</title>
<link rel="stylesheet" href="../../bowercss/bowercss.css" />
<link rel="stylesheet" href="../../css/index.css">
<script type="text/javascript" src="../../js/angular.min.js"></script>
<script type="text/javascript" src="../../js/angular-ui-router.min.js"></script>
<script type="text/javascript" src="../../js/app.js" ></script>
</head>
<body>
<div class="index_head">
<div class="menu">
<ul class="nav">
<li><a>首页</a></li>
<li><a>税务查询</a></li>
<li><a>对账</a></li>
<li><a>其他</a></li>
</ul>
</div> </div>
</body>
</html>app.jsvar routerApp = angular.module("routerApp", ['']);routerApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when("", "/index"); $stateProvider
.state("index", {
url: "/index",
templateUrl: "index.html"
})
.state("tax-yz", {
url:"/tax-yz",
templateUrl: "tax-yz.html"
});
});在谷歌浏览器F12调试的时候一直报错,Failed to instantiate module routerApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.6.9/$injector/modulerr?p0=&...)
at http://localhost:8866/js/angular.min.js:1:556
at http://localhost:8866/js/angular.min.js:1:14549
at ut (http://localhost:8866/js/angular.min.js:1:991)
at i (http://localhost:8866/js/angular.min.js:1:14103)
at http://localhost:8866/js/angular.min.js:1:14289
at ut (http://localhost:8866/js/angular.min.js:1:991)
at i (http://localhost:8866/js/angular.min.js:1:14103)
at Pt (http://localhost:8866/js/angular.min.js:1:16233)
at i (http://localhost:8866/js/angular.min.js:1:7975)
at V (http://localhost:8866/js/angular.min.js:1:8286官网给出的文档是这么说的
Description
This error occurs when a module fails to load due to some exception. The error message above should provide additional context.A common reason why the module fails to load is that you've forgotten to include the file with the defined module or that the file couldn't be loaded.Using ngRoute
In AngularJS 1.2.0 and later, ngRoute has been moved to its own module. If you are getting this error after upgrading to 1.2.x or later, be sure that you've installed ngRoute.Monkey-patching AngularJS's ng module
This error can also occur if you have tried to add your own components to the ng module. This has never been supported and from 1.3.0 it will actually trigger this error. For instance the following code could trigger this error.angular.module('ng').filter('tel', function (){});但是找了半天问题,angularjs引入的没问题,我把app.js删除了 只要添加ng-app标签会报错
<html lang="en" ng-app="routerApp">
<head>
<meta charset="utf-8" />
<meta name="renderer" content="webkit">
<title>首页</title>
<link rel="stylesheet" href="../../bowercss/bowercss.css" />
<link rel="stylesheet" href="../../css/index.css">
<script type="text/javascript" src="../../js/angular.min.js"></script>
<script type="text/javascript" src="../../js/angular-ui-router.min.js"></script>
<script type="text/javascript" src="../../js/app.js" ></script>
</head>
<body>
<div class="index_head">
<div class="menu">
<ul class="nav">
<li><a>首页</a></li>
<li><a>税务查询</a></li>
<li><a>对账</a></li>
<li><a>其他</a></li>
</ul>
</div> </div>
</body>
</html>app.jsvar routerApp = angular.module("routerApp", ['']);routerApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.when("", "/index"); $stateProvider
.state("index", {
url: "/index",
templateUrl: "index.html"
})
.state("tax-yz", {
url:"/tax-yz",
templateUrl: "tax-yz.html"
});
});在谷歌浏览器F12调试的时候一直报错,Failed to instantiate module routerApp due to:
Error: [$injector:modulerr] http://errors.angularjs.org/1.6.9/$injector/modulerr?p0=&...)
at http://localhost:8866/js/angular.min.js:1:556
at http://localhost:8866/js/angular.min.js:1:14549
at ut (http://localhost:8866/js/angular.min.js:1:991)
at i (http://localhost:8866/js/angular.min.js:1:14103)
at http://localhost:8866/js/angular.min.js:1:14289
at ut (http://localhost:8866/js/angular.min.js:1:991)
at i (http://localhost:8866/js/angular.min.js:1:14103)
at Pt (http://localhost:8866/js/angular.min.js:1:16233)
at i (http://localhost:8866/js/angular.min.js:1:7975)
at V (http://localhost:8866/js/angular.min.js:1:8286官网给出的文档是这么说的
Description
This error occurs when a module fails to load due to some exception. The error message above should provide additional context.A common reason why the module fails to load is that you've forgotten to include the file with the defined module or that the file couldn't be loaded.Using ngRoute
In AngularJS 1.2.0 and later, ngRoute has been moved to its own module. If you are getting this error after upgrading to 1.2.x or later, be sure that you've installed ngRoute.Monkey-patching AngularJS's ng module
This error can also occur if you have tried to add your own components to the ng module. This has never been supported and from 1.3.0 it will actually trigger this error. For instance the following code could trigger this error.angular.module('ng').filter('tel', function (){});但是找了半天问题,angularjs引入的没问题,我把app.js删除了 只要添加ng-app标签会报错
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货