1

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 Answer 1

5

I think you might want to call that immediate function:

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

Otherwise, the JavaScript inside is never run.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.