Angular的视图路由未显示(注入模块化程序错误)

时间:2016-07-09 19:40:04

标签: javascript angularjs

我似乎遇到了Angular路由问题。我当前的index.html文件仅显示index.html文件中的标题div,但不显示应显示位于views / login.html的新页面的代码的ng-view方面。



var app = angular.module('Bandit', ['ngRoute']);

app.config(['$routeProvider', 'locationProvider', function($routeProvider, $locationProvider) {
    $locationProvider.html5Mode(true);
	$routeProvider

        //login feedback page
        .when('/feedback', {
            templateUrl: 'views/loginfeedback.html',
            controller: 'loginFeedbackController'
        })


        // home page
        .when('/', {
            templateUrl: 'views/login.html',
            controller: 'loginController'
        })

        //Catch all
        .otherwise({ 
            redirectTo: '/'
        });
    }
]);

<!DOCTYPE html>
<html lang="ENG">



	<head>

		<title>Band-it</title>
  		<meta charset="utf-8">
	  	<meta name="viewport" content="width=device-width, initial-scale=1">

	  	<!--Imported Style-->
	  	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

	  	<!--Custome Stylesheets-->
	  	<link rel="stylesheet" type="text/css" href="css/universal.css">
	  	<link rel="stylesheet" type="text/css" href="css/login.css">

	  	<!--Imported JS Libraries-->
	    <script src="libs/angular/angular.min.js"></script>
	    <script src="libs/angular-route/angular-route.min.js"></script>
	  	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	  	<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

		<!--Custom-->
		<script type="text/javascript" src="js/appRoutes.js"></script>
		<script type="text/javascript" src="js/app.js"></script>
		<script type="text/javascript" src="js/controllers/loginController.js"></script>

	</head>




	<body ng-app="Bandit">
		<div class='header'>
			<h1 id='symbol'>B</h1>
		</div>


		<!--Angular Dynamic View-->
		<div ng-view></div>


	</body>
</html>
&#13;
&#13;
&#13;

我收到的来自控制台的错误消息是:

angular.js:38未捕捉错误:[$ injector:modulerr] [http://errors.angularjs.org/1.5.7/ $ injector / modulerr?p0 =强盗&amp; p1 =错误%3A%... Fbandit%2FBanditMask%2Fpublic%2Flibs%2Fangular%2Fangular .min.js%3A39%3A222] 1

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:1)

使用$locationProvider代替locationProvider中的app.config。并且不确定请分享链接。