Search code examples
angularjsjsfiddle

AngularJS: Uncaught Error: [$injector:modulerr] with jsfiddle


Why is this simple script throwing a Uncaught Error: [$injector:modulerr] in the console?

<script>
angular.module('HelloWorldApp', []);
angular.module('HelloWorldApp').controller('HelloWorldController', function($scope) {
       $scope.greeting = "Hello World";
});
</script>
<div ng-app="HelloWorldApp">
    <div ng-controller="HelloWorldController">
        <h1>{{greeting}}</h1>
    </div>
</div>

https://jsfiddle.net/Lccfcrwm/


Solution

  • Got your fiddle working, actually in the javascript pane you need to select angular 1.x version and it will start working

    here is the fiddle: https://jsfiddle.net/2xxf507e/

     angular.module('HelloWorldApp', []);
     angular.module('HelloWorldApp').controller('HelloWorldController', function($scope) {
           $scope.greeting = "Hello World";
    });
    

    Setting Image

    and the setting image