angular.js:38未捕获错误:[$ injector:modulerr]

时间:2016-09-16 09:35:05

标签: angularjs

我是angular.js的新手,我的第一次尝试非常糟糕。 我收到错误,我试图调试它,但现在我有点沮丧。 错误是

angular.js:38Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.6/$injector/modulerr?p0=myapp&p1=Error%3A%2…oogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.6%2Fangular.min.js%3A21%3A19)(anonymous function) @ angular.js:38(anonymous function) @ angular.js:4630q @ angular.js:322g @ angular.js:4591db @ angular.js:4513c @ angular.js:1777Ac @ angular.js:1798fe @ angular.js:1683(anonymous function) @ angular.js:31018b @ angular.js:3197Rf @ angular.js:3487d @ angular.js:3475

这是我的代码:

的index.html

<!DOCTYPE html>
<html lang="en" ng-app="myapp">
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<title>User Story</title>
</head>

<script src="../app.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-route.min.js"></script>

<body>
  <h1>Hello Baby Users</h1>
  {{2+2}}
</body>
</html>

并为: app.js

angular.module('myapp',[]);

1 个答案:

答案 0 :(得分:1)

您的脚本app.js应在angularjs引用

之后加载

<强> DEMO APP

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>     
<script src="../app.js"></script>