在尝试将我的 angularjs 代码分成可管理的块时,我 运行 在控制台中出现此错误:

While trying to separate my angularjs code into manageable chunks i run into this error in the console:

当我从终端 运行 这个项目时

cd to AppointmentScheduler
node index.js

我现在在控制台中收到以下错误 未捕获的类型错误:未定义不是函数angular-route.js:26(匿名函数)angular-route.js:6(匿名函数)

This is the index.html
<html>
    <head ng-app="appointments">
        <title>Appointments</title>
        <script type="text/javascript" src="js/lib/angular.min.js"></script>
        <script type="text/javascript" src="js/lib/angular-resource.min.js"></script>
        <script type="text/javascript" src="js/controllers/app.js"></script>
        <script type="text/javascript" src="js/app.js"></script>
                <script type="text/javascript" src="js/lib/angular-route.min.js"></script>

        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.min.css">
    </head>
    <body>
        <div class="container">
            <h1>Piar Appointments Scheduler</h1>
            <div ng-view></div>
        </div>
    </body>
</html>
This is the login.html
   <div class="row-fluid">
                <form class="form-horizontal">
                  <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label" required>Email</label>
                    <div class="col-sm-8">
                      <input type="email" class="form-control" id="inputEmail3" placeholder="Email" required>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">Password</label>
                    <div class="col-sm-8">
                      <input type="password" class="form-control" id="inputPassword3" placeholder="Password">
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-8">
                      <div class="checkbox">
                        <label>
                          <input type="checkbox"> Remember me
                        </label>
                      </div>
                    </div>
                  </div>
                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <button type="submit" class="btn btn-default">Sign in</button>
                    </div>
                  </div>
                </form>
            </div>
This is the public/js/app.js
var appointments = angular.module('appointments', ['ngRoute']);
appointments.config(function ($routeProvider) {
    $routeProvider
        .when('/',
              {templateUrl: 'partials/login.html'})
})
This is the public/js/controllers/app.js That has been edited, sorry about the error of repeating the content of the public/js/app.js here

function LoginCtrl ($scope) 
{
 
}

 currently watching up and running with angularjs by Joseph LeBlanc from Lynda.com

您的 js/app.js 和 js/controllers/app.js 似乎完全相同 - 但我认为问题在于您正在尝试使用 ngRoute 而不加载它

   <script type="text/javascript" src="js/lib/angular-route.min.js"></script>

此外,将 ng-app 放在 <html><body> 元素中,如果您在 <head> 中,那将是您应用程序的根元素,因此它不会甚至触摸 <body>