AngularJS:未捕获错误:来自angular include的[$ injector:modulerr]

时间:2017-04-11 15:21:25

标签: javascript angularjs

我得到了Uncaught Error:[$ injector:modulerr]来自角度包含,我猜是因为没有更多。

我做错了什么?

<!doctype html>
<html ng-app="demo">
<head>
<title>Hello AngularJS</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.3/angular.min.js"></script>
</head>
<body>
</body>
</html>

错误:

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.3/$injector/modulerr?p0=demo&p1=Error%3A%20…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.3%2Fangular.min.js%3A22%3A179)
    at angular.js:38
    at angular.js:4920
    at p (angular.js:402)
    at g (angular.js:4880)
    at eb (angular.js:4802)
    at c (angular.js:1909)
    at Pc (angular.js:1930)
    at ue (angular.js:1815)
    at angular.js:33340
    at HTMLDocument.b (angular.js:3435)

1 个答案:

答案 0 :(得分:5)

您编写ng-app="demo"但没有脚本文件js。请添加

(function(){
 angular.module('demo',[]);
})()

并添加html

<script src="script.js></script>