为什么角度在此处未定义

时间:2018-01-24 12:53:06

标签: angularjs

由于我是编程世界的新手,我开始使用angularjs代码。 我想知道为什么会出现这种错误。每当我提供角度模块名称时,它显示角度未定义。

enter image description here



// Weather app module creation

var weather = angular.module('weather', ['ngRoute', 'ngResource'])

// config

weather.config(function($routeProvider) {
  $routeProvider

    .when('./', {
      templateUrl: 'home.htm',
      controller: 'homeC'
    })
    .when('/forecast', {
      templateUrl: 'fore.html',
      controller: 'foreC'
    })
})

<!DOCTYPE html>
<html lang="en" ng-app="weather">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Weather</title>
  <link rel="stylesheet" href=".\bootstrap-4.0.0-dist\css\bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.7/angular.min.js"></script>
</head>

<body>
  <header>
    <nav class="navbar navbar-default">
      <div class="container-fluid">
        <div class="navbar-header">
          <a href="/" class="navbar-brand">Weather</a>
        </div>
        <ul class="nav navbar-nav navbar-right">
          <li><a href="#"><i class="fa fa-home"></i>Home</a></li>
        </ul>
      </div>
    </nav>
  </header>
  <div class="container">
    <div ng-view>

    </div>
  </div>
</body>

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

1 个答案:

答案 0 :(得分:1)

您的脚本在角度库之前加载。 这应该工作:

    Column     |  Type   |                       Modifiers
---------------+---------+-------------------------------------------------------
 id            | integer | not null default nextval('house_id_seq'::regclass)
 owner_id      | integer | not null
Indexes:
    "house_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
    "house_owner_id_fkey" FOREIGN KEY (owner_id) REFERENCES owner(id) DEFERRABLE INITIALLY DEFERRED