I am new to AngularJS and currently writing my first project.
Currently my controllers look like this, for example:
function MyCtrl($scope, MyService) {
$scope.foo = MyService.doStuff();
}
They work just fine that way (so far), but I browsed the source of another AngularJS application and noticed they're using angular.module to create their controllers.
Why, if at all, would I want to do this in my own application?
Thank you!
If you have multiple angular applications on your page and they have controllers with the same name you'll need to use module.controller to avoid conflicts. The same if you want to avoid pollute the global namespace