Currently I have MyAngularModule similar to this:
/app/material/material.module.ts
import { MatButtonModule, MatIconModule } from '@angular/material';
const MaterialComponents = [
MatButtonModule,
MatIconModule,
...
];
@NgModule({
imports: [
MaterialComponents
],
exports: [
MaterialComponents
],
})
export class MyMaterialModule {
}
This is imported once in AppModule now.
Currently I have a "flat" module architecture, all loaded eagerly.
Now I'm changing application architecture to have core, shared and feature s modules (lazy loaded using loadChildren).
eg.
/features/data-grid/data-grid.module.ts
This module will be using some Angular Material components (eg. SpinnerModule), but not all of them.
Other feature modules will be using some other Material components.
Some of the components will be obviously used in many of the feature modules.
The question is: how should I load required material components in feature modules?
Shall MyMaterialModule be a submodule of a shared module?