M-S M-S - 3 years ago 116
Javascript Question

Angular injector error with self invocation function syntax

I have created a basic angular app, with self invoking function


When ever I am running the application it is throwing injector error, if I remove the above code, it is working fine, I have gone through many sites but unable to fix this, and why it is happening I am unable to understand.


<!DOCTYPE html>

<link rel="stylesheet" href="style.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js"></script>
<script src="script.js"></script>

<body ng-app="myApp">
<h1>Hello Plunker!</h1>



angular.module("myApp", [])


Answer Source

You need to have like this,

  angular.module("myApp", [])  


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download