How does inheritance and dependency depend on angular modules?

I am a little confused about how angular modules are designed to work and what would be the best way to use them. I read in the book that the services are available all over the world no matter which module includes them. Filters and directives are obviously also available in the template files of the entire application.

A short example:


angular.module('one',[]).service('oneService', ...);
    // angular-module 'one' does not have to be passed here
    // available here;



// not a good idea
angular.module('three').service('oneService', ...);


Which actually leads to several questions for me:

  • What is a good way to "think" of angular modules if there is no real closure?
  • Aside from the semantics and the resulting folder structure (which can be done without using modules) - what are the benefits of splitting one application into different modules?
  • Is there any legacy automatic use when using dot notation for modules eg. angular.module('main')

    and angular.mopdule('main.customers')

  • Separates the app in different apps (not modules) as an alternative eg. one app for each route, and if so, what would be a good way to do this since apps cannot contain other apps ?

source to share

1 answer

Mishko Kheveri discusses it here:

Then Naomi Black appears:

What's the link to these docs:

Also the latest version of angular documentation states :

... we recommend that you split your application into several modules for example:

  • Module for each function
  • A module for each reusable component (especially directives and filters)
  • And an application level module that depends on the above modules and contains any initialization code.


  • modules are just a way to configure the DI subsystem (at least so far).
  • If you want to use modules that separate your application by function and not by type
  • in fact, it is recommended now to structure your application with one module per function. Modules
  • do not provide much benefit right now, but in the near future they may appear with lazy loading of views.


All Articles