0

我收到此错误。

未捕获的错误:[$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>

应用程序.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(){

});
4

1 回答 1

0

您在 $routeProvider.when('home'...

应该:

$routeProvider.when('home',{
    templateUrl:'home.html',
    controller:'HomeController'
});
于 2014-10-24T12:49:25.413 回答