docs(ngmodule-faq): eager loaded Routed Feature Module must be imported (#2304)

fixes #2298
This commit is contained in:
Ward Bell 2016-09-13 12:27:27 -07:00 committed by GitHub
parent 98e5bc248e
commit c5ad38ee86

View File

@ -781,14 +781,20 @@ table
_Routed Feature Modules_ are _Domain Feature modules_ _Routed Feature Modules_ are _Domain Feature modules_
whose top components are the **targets of router navigation routes**. whose top components are the **targets of router navigation routes**.
All lazy loaded modules are routed feature modules by nature. All lazy loaded modules are routed feature modules by definition.
This chapter's `ContactModule`, `HeroModule` and `CrisisModule` are routed feature modules. This chapter's `ContactModule`, `HeroModule` and `CrisisModule` are routed feature modules.
Routed Feature Modules _should not export anything_. Routed Feature Modules _should not export anything_.
They don't have to because none of their components ever appear in the template of an external component. They don't have to because none of their components ever appear in the template of an external component.
Routed Feature Modules are _never imported_. A lazy loaded Routed Feature Module should _not be imported_ by any module.
Doing so would trigger an eager load, defeating the purpose of lazy loading.
`HeroModule` and `CrisisModule` are lazy loaded. They aren't mentioned among the `AppModule` imports.
But an eager loaded Routed Feature Module must be imported by another module
so that the compiler learns about its components.
`ContactModule` is eager loaded and, therefore, is listed among the `AppModule` imports.
Routed Feature Modules rarely have _providers_ for reasons [explained earlier](#q-why-bad). Routed Feature Modules rarely have _providers_ for reasons [explained earlier](#q-why-bad).
When they do, the lifetime of the provided services When they do, the lifetime of the provided services