我收到此错误。
未捕捉错误:[$ injector:modulerr] http://errors.angularjs.org/1.2.26/ $ injector / modulerr?p0 = app& p1 = TypeError%3 ... gleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min。 JS%3A18%3A387)
HTML
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Angular Intro</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./css/signin.css" rel="stylesheet">
<!-- <link rel="stylesheet" href="style.css"> -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-route.min.js"></script>
<script src="js/app.js"></script>
</head>
<body>
<div class="row">
<div class="col-md-12">
<h1 class="text-center">Angular App</h1>
<div id="view" ng-view>
</div>
</div>
</div>
</body>
</html>
App.js
var app=angular.module('app', ['ngRoute']).config(function($routeProvider){
$routeProvider.when('login',{
templateUrl:'login.html',
controller:'LoginController'
});
$routeProvider.when('home'),{
templateUrl:'home.html',
controller:'HomeController'
}
$routeProvider.otherwise({redirectTo : '/login'});
});
app.controller('LoginController', function(){
});
app.controller('HomeController', function(){
});
答案 0 :(得分:0)
你在$ routeProvider.when中有一个拼写错误(&#39; home&#39; ...
应该是:
$routeProvider.when('home',{
templateUrl:'home.html',
controller:'HomeController'
});