使用Angular.js加载页面时出现以下错误。
错误:
angularjslatest.js:7 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.5/$injector/modulerr?p0=bookingjini&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.6.5%2F%24injector%2Fmodulerr%3Fp0%3D720kb.datepicker%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.6.5%252F%2524injector%252Fnomod%253Fp0%253D720kb.datepicker%250A%2520%2520%2520%2520at%2520http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A7%253A76%250A%2520%2520%2520%2520at%2520http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A26%253A408%250A%2520%2520%2520%2520at%2520b%2520(http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A25%253A439)%250A%2520%2520%2520%2520at%2520http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A26%253A182%250A%2520%2520%2520%2520at%2520http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A42%253A290%250A%2520%2520%2520%2520at%2520p%2520(http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A8%253A7)%250A%2520%2520%2520%2520at%2520g%2520(http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A42%253A138)%250A%2520%2520%2520%2520at%2520http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A42%253A322%250A%2520%2520%2520%2520at%2520p%2520(http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A8%253A7)%250A%2520%2520%2520%2520at%2520g%2520(http%253A%252F%252F10.25.25.100%252Fbookingjini%252Fjs%252Fangular%252Fangularjslatest.js%253A42%253A138)%0A%20%20%20%20at%20http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A7%3A76%0A%20%20%20%20at%20http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A43%3A70%0A%20%20%20%20at%20p%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A8%3A7)%0A%20%20%20%20at%20g%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A42%3A138)%0A%20%20%20%20at%20http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A42%3A322%0A%20%20%20%20at%20p%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A8%3A7)%0A%20%20%20%20at%20g%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A42%3A138)%0A%20%20%20%20at%20gb%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A46%3A251)%0A%20%20%20%20at%20c%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A22%3A19)%0A%20%20%20%20at%20Uc%20(http%3A%2F%2F10.25.25.100%2Fbookingjini%2Fjs%2Fangular%2Fangularjslatest.js%3A22%3A332) at angularjslatest.js:7 at angularjslatest.js:43 at p (angularjslatest.js:8) at g (angularjslatest.js:42) at gb (angularjslatest.js:46) at c (angularjslatest.js:22) at Uc (angularjslatest.js:22) at xe (angularjslatest.js:21) at HTMLDocument.<anonymous> (angularjslatest.js:333) at j (jquery-1.11.0.min.js:2)
我在下面提供我的代码。
index.html:
<!DOCTYPE html>
<html lang="en" ng-app="bookingjini">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Home</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<link href="http://fonts.googleapis.com/css?family=Lato:300,400%7COpen+Sans:300,400,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/library/font-awesome.min.css">
<link rel="stylesheet" href="css/library/bootstrap.min.css">
<link rel="stylesheet" href="css/library/jquery-ui.min.css">
<link rel="stylesheet" href="css/library/owl.carousel.css">
<link rel="stylesheet" href="css/library/jquery.mb.YTPlayer.min.css">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/library/jquery-1.11.0.min.js">
</script>
<script src="js/angular/angularjslatest.js" type="text/javascript"></script>
<script src="js/angular/angularuirouterlatest.js" type="text/javascript"></script>
<script src="js/angular/route.js" type="text/javascript"></script>
<script src="js/angular/angularcaps.js" type="text/javascript"></script>
<script src="js/angular/angular-messages.js" type="text/javascript"></script>
<script src="js/angular/angularuibootstrap.js" type="text/javascript"></script>
<script src="js/angular/ng-file-upload-shim.min.js"></script>
<script src="js/angular/ng-file-upload.min.js"></script>
<script src="js/angular/dirPagination.js"></script>
<script src="js/angular/angular-chosen.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="js/library/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/library/bootstrap.min.js"></script>
<script type="text/javascript" src="js/library/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/library/parallax.min.js"></script>
<script type="text/javascript" src="js/library/jquery.nicescroll.js"></script>
<script type="text/javascript" src="js/library/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="js/library/jquery.mb.YTPlayer.min.js"></script>
<script type="text/javascript" src="js/library/SmoothScroll.js"></script><script type="text/javascript" src="js/script.js"></script>
</head>
<body>
<div ui-view>
</div>
<script src="controller/homeController.js"></script>
</body>
</html>
route.js:
var Admin=angular.module('bookingjini',['ui.router', '720kb.datepicker','ngMessages','ngCapsLock','ui.bootstrap','ngFileUpload','angularUtils.directives.dirPagination','angular.chosen']);
Admin.run(function($rootScope, $state) {
$rootScope.$state = $state;
});
Admin.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('/',{
url: '/',
templateUrl: 'view/home.html',
controller: 'homeController'
})
})
这里我使用的是角度版本1.6.x
和角度ui-router
版本@version v1.0.3
。当我运行索引页面时,出现上述错误。
答案 0 :(得分:0)
您应该喜欢下面的代码。
var Admin=angular.module('bookingjini',['ui.router', 'ngMessages','ngCapsLock','ui.bootstrap','ngFileUpload','angularUtils.directives.dirPagination','angular.chosen']);
Admin.run(function($rootScope, $state) {
$rootScope.$state = $state;
});
Admin.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('/',{
url: '/',
templateUrl: 'view/home.html',
controller: 'homeController'
})
})
从先前的代码中删除'720kb.datepicker'
。