Using angular.module()
with two parameters (e.g. angular.module('aziz-module', [])
) would result in setting a new module with its corresponding dependencies. In contrast, when using angular.module('aziz')
the corresponding module is looked up internally and returned to the caller (getting).
The means when you first define you application you might just create the following files and structure.
app.js
angular.module('myApp',[]);
FirstController.js
angular.module('myApp').controller('FirstController',function(){});
SecondController.js
angular.module('myApp').controller('SecondController',function(){});
If you now include these files in your html document in this particularly order (at least app.js has to come first), your application works just fine with two separate controllers in two separate files.