[Fixed]-Uncaught Error: [$injector:modulerr]

1👍

The reason should be somewhere else. The code provided works

var myHeader = angular.module('myHeader', []);

myHeader.controller('HeaderController' , ['$scope', function($scope){

    $scope.message = "hello";

}])
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myHeader">
    <div ng-controller="HeaderController">
          <h1>{{message}}</h1>
    </div>
</body>

The problem is certainly linked to this line

<script  type="text/javascript" src="{% static 'js/myHeader.module.js' %}"></script>

Make sure that the src is the correct one

Leave a comment