模块'App'不可用!您要么错误拼写了模块名称,要么忘记在AngularJS中加载它

时间:2016-05-31 07:52:22

标签: javascript angularjs

我正在使用angularJS开发一个简单的Web应用程序,我遇到了这个问题我无法解决。运行我的网站我在控制台中收到此错误:

  

未捕获错误:[$ injector:modulerr]无法实例化模块App   由于:错误:[$ injector:nomod]模块'App'不可用!您   要么错误拼写模块名称,要么忘记加载它。如果注册   模块确保您将依赖项指定为第二个   参数。

但我确定我没有拼错模块名称或忘记加载它。这是我的代码:

<!DOCTYPE html>
<html ng-app="App">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
    <meta name="description" content="">
    <meta name="author" content="AUTHOR">
    <title>PROJECT NAME | Login</title>
    <link rel="stylesheet" href="/bower_components/angular-material/angular-material.css">
    <link rel="stylesheet" href="/bower_components/angular-ui-notification/dist/angular-ui-notification.min.css">
    <link rel="stylesheet" href="css/main.css" type="text/css">
  </head>
  <body ng-class="location" ng-cloak>
    <div ng-view></div>
    <script defer src="/bower_components/angular/angular.js"></script>
    <script defer src="/bower_components/angular-route/angular-route.js"></script>
    <script defer src="/bower_components/angular-aria/angular-aria.js"></script>
    <script defer src="/bower_components/angular-animate/angular-animate.js"></script>
    <script defer src="/bower_components/angular-messages/angular-messages.js"></script>
    <script defer src="/bower_components/angular-ui-notification/dist/angular-ui-notification.min.js"></script>
    <script defer src="/bower_components/angular-material/angular-material.js"></script>
    <script defer src="/bower_components/jquery/dist/jquery.js"></script>
  </body>
</html>

这是我的index.html:

{{1}}

我已经用凉亭安装了所有包......

有人可以告诉我问题在哪里,我该如何解决?

1 个答案:

答案 0 :(得分:4)

根据您提供的HTML,您似乎忘记添加自己的脚本。我只看到包含bower_components内容