I have just started developing with AngularJS a few days ago, and this issue really bugs me.
I keep getting this error:
Error: ng:areq
Bad Argument
Argument 'NewStudentCtrl' is not a function, got undefined
All other controllers are working since I am using them in other files, just NewStudentCtrl won't work.
I have tried a lot of different things, only one worked: defining the controller using function NewStudentCtrl ($scope) {} inside the HTML file itself right before the use of the controller. The problem is that I want to split HTML and JS into seperate files.
Please note that the provided source is simplified a lot, there might be little indentation or syntax errors.
<html ng-app="myApp">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
  <script>var app = angular.module('myApp',[]);</script>
</head>
<body>
  <div ng-controller="NewStudentCtrl">
    <div ng-controller="AccountMenuCtrl">
    </div>
    <script src="js/account-menu.js">
      function AccountMenuCtrl ($scope) {
    }
    </script>
    <div ng-controller="OrtsteileCtrl">
        <option value="{{ortsteil.ID}}" ng-repeat="ortsteil in ortsteile">
          {{ortsteil.Name}}
        </option>
    </div>
    </div> <!-- end NewStudentCtrl -->
  <!-- Loading dependencies -->
  <script src="js/jquery-1.8.3.min.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script src="js/new-student.js">
    var app = angular.module("myApp");
    function NewStudentCtrl ($scope) {
    }
  </script>
  <script src="js/plz.js">
    angular.module('myApp').controller('OrtsteileCtrl', ['$scope', '$http',
      function($scope, $http) {
    }]);
  </script>
</body>
</html>


NewStudentCtrl?OrtsteileCtrl?functionsyntax because that worked HTML-inlined.