I have read a lot of descriptions on modules in angularjs and am perplexed as to what their purpose really is. Let me explain my situation with a bit of code, this is firstly how I am supposed to do according to best practices:
angular.module('secondModule',[]).controller('myController',function(){
//do something
};
angular.module('app',['secondModule']);
However as I see it (and from reading parts of the angularjs source code) this is under the hood exactly the same as:
angular.module('app',[]).controller('myController',function(){
//do something
};
Basically no matter in which module I create my controllers, filters, directives etc. they will still all go into a single global bucket, once a controller is created it is simply registered to the global controller list and has no connection what so ever to the module it was created with.
The only thing I seem to see that the modules are good for is specifying in which order they should be interpreted by the browser (by specifying dependencies in the module declaration).
So the question is simply, what am I missing, why should I use modules when whatever I create using those modules are still sitting in the same global bucket?