I would to understand the use of angular module more clearly and deeply.
I have a folder of directives where each directive is on separate file.
My first file(first directive) has a declaration of
Your first file is declaring the angular module. When you pass a second parameter to the
angular.module function, you are declaring it. Without the parameter, you are referencing it.
angular.module('moduleName', ['dep1', 'dep2'])
A module can only been declared once.
Once it is declared, you can "attach" controllers and services etc. to it.
As for you second question, it is generally okay and considered good practice to reference the module in the way you do (
However, if you really don't want to, you can save it to a variable.
var myModule = angular.module('name'); module.directive('directiveName', ...);