I am getting the above error within a partial template loaded into the main html. When I declare the controller as global it works (MyController1), also when I declare the controller directly within "app.controllers" it works, but when I declare the controller (MyController) as part of the partial template the above error appears. Any help?
Code
<div ng-controller='MyController1'>
<span ng-bind="mydesc"></span>
</div>
<script type="text/javascript">
function MyController1($scope) {
$scope.mydesc = "Direct Global Definition";
console.log('in Direct');
}
angular.module('app.controllers').controller('MyController',['$scope',function($scope) {
$scope.mydesc = "Defined as part of Controller Inline";
}]);
</script>
The above code works, but when I change ng-controller="MyController1" to ng-controller="MyController", the error appears.
I don't want to use global functions and I can't add every partial controller to "app.controllers".