I've seen this done two ways:
The
module
is assigned a global variable which is then appended to directives, controllers, and services:var app = angular.module('myApp', [ ]); app.directive('myDirective' function() { // directive stuff here });
Or the the module is used as-is like:
angular.module('myApp', [ ]) .directive('myDirective' function() { // directive stuff here });
So why would you do it one way or the other?