Levels of abstraction on AngularJS Architecture

315 views Asked by At

1) What are your considerations when planning the architecture of an AngularJS application?

What is your mental process?

2) Which criteria do you take in consideration to decide if you will:

2.a) Make each part of your application it's own module and inject each module to the main module as a dependency?

angular.module('WebsitePart1', []);
angular.module('WebsitePart2', []);
angular.module('Main', ['WebsitePart1','WebsitePart2']);

2.b) Create only one module, and attach everything else (directives, controllers, services, etc) to the main module?

var mynamespace = angular.module('', ['ngRoute']);

And then attach a controller to each router setup, attach the directives to the mynamespace module, etc.

Thank you for sharing your take on it!

0

There are 0 answers