Matt Brewerton Matt Brewerton - 1 year ago 136
AngularJS Question

How to wrap multiple Angular Modules under one injected Module

I'm working on an Angular project that will require modularisation and I will be creating many small modules for it. Example:

etc. each being its own file compiled into one with gulp. When I inject
into another project, I want to be able to consume all modules in one
injection, like so:

angular.module('project2', ['myApp'])

instead of:

angular.module('project2', [

Much like the Angular team have done with Material. Everything is its own module, but in order to use Angular Material, you only have to add
as a dependency.

Answer Source
  angular.module('project2', ['myApp']);

  angular.module('myApp', ['components']);

  angular.module('components', ['component1','component2','component3']);

  angular.module('component1', []);
  angular.module('component2', []);
  angular.module('component3', []);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download