1
votes

Please help to understand what is the problem. I'm very new to AngularJS and maybe I missed something. Here is my simple 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>

JS

(function(){
    var app = angular.module('myApp',[]);
});

and all time error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

1

1 Answers

5
votes

I think you might want to call that immediate function:

(function(){
    var app = angular.module('myApp',[]);
})();

Otherwise, the JavaScript inside is never run.