Angularjs模块未正确加载

Ale*_*lka 1 javascript angularjs

请帮忙了解问题所在.我对AngularJS很新,也许我错过了一些东西.这是我简单的HTML:

<!DOCTYPE html>
<html>
    <script type="text/javascript" src="angular.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body ng-app="myApp">

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

JS

(function(){
    var app = angular.module('myApp',[]);
});
Run Code Online (Sandbox Code Playgroud)

和所有时间错误:
未捕获错误:[$ injector:modulerr]由于以下原因无法实例化myApp模块:错误:[$ injector:nomod]模块'myApp'不可用!您要么错误拼写了模块名称,要么忘记加载它.如果注册模块,请确保将依赖项指定为第二个参数.

Dav*_*yon 5

我想你可能想要称之为即时功能:

(function(){
    var app = angular.module('myApp',[]);
})();
Run Code Online (Sandbox Code Playgroud)

否则,JavaScript内部永远不会运行.