Following several advices on how to structure an angular application, I end up with this file organization :
- app
- core
- header
- sidenav
core.module.ts
- shared
- material
custom-material.module.ts
shared.module.ts
- features
app.module.ts
- I have a core module and a shared module
- The core module exports global components such as HeaderComponent or SidenavComponent
- The shared module exports a CustomMaterial submodule (I heard it was the way to do things)
- The CustomMaterial submodule exports the different material components I need
- The app module only imports the core module (since shared module should only be imported by elements that need it)
- The modules in
features/
are lazy loaded
But now, my problem is : my header component needs some material components.
Should I import my shared module into my core module or into my app module ? But it seems like an anti-pattern to me.
CoreModule
to import theSharedModule
, but should not export it. – crush