http://blog.angular-university.io/angular2-ngmodule/
Modules are very useful, but beware of the following pitfalls:
- do not redeclare a component, directive, etc. in more than one module
- modules do not create their own DI context, so injectables are available also outside the module
- unless the module is lazy loaded, in that case a separate DI context is created by the router to avoid accidental injectable overrides and prevent hard to troubleshoot bugs
- if you have a shared module that needs to be added to a lazy loaded module, make sure that it does not have providers, because that would create duplicate service instances (unless that is the intended behavior)
providers
: injectables (annotated by@Injectable()
) available from this module's DI context (injector)declarations
: components/directives/pipes included/defined in this moduleimports
: modules depended by this moduleexports
: components/directives/pipes exported by this module (these are visible to another module which imports this module)bootstrap
: components for bootstrapping this moduleentryComponents
: components that should be compiledschemas
: ?