I have a following module
@NgModule({
declarations: [
AgPaginationComponent,
AgGridNoRowsComponent,
// a huge list of components
],
exports: [AgPaginationComponent, AgGridModule],
imports: [
CommonModule,
InputsModule,
FormsModule,
NgbPaginationModule,
NgbPopoverModule,
AgGridModule.withComponents([
AgGridNoRowsComponent,
// the same huge list from declarations
]),
PipesModule,
]
})
export class MyAgGridAddonsModule { }
You see here that it's possible to configure AgGridModule
by specifying a list of components in withComponents
array. The idea behind MyAgGridAddonsModule
module was to create one module that I can use every time when I need to initialize AgGridModule. But turns out the module is growing too fast and has too many components under AgGridModule.withComponents
declaration. Now I want to have a possibility to specify which dependencies I want to use each particular time but in the same time copy base configuration that is the same for every case.
I want to accomplish something like
@NgModule({
imports: [
MyAgGridAddonsModule.withComponents([
MyAgInputFilter,
MyAgLiveSearchFilter,
MyAgSelectFilter,
MyAgDateCellRenderer,
])
]
})
export class MyAnotherModule { }
And the array of components from MyAgGridAddonsModule.withComponents
should be passed down to MyAgGridAddonsModule
:
@NgModule({
declarations: [
AgPaginationComponent,
AgGridNoRowsComponent,
// components passed down from MyAnotherModule
],
exports: [AgPaginationComponent, AgGridModule],
imports: [
CommonModule,
InputsModule,
FormsModule,
NgbPaginationModule,
NgbPopoverModule,
AgGridModule.withComponents([
// components passed down from MyAnotherModule
AgGridNoRowsComponent
]),
PipesModule,
]
})
export class MyAgGridAddonsModule { }
Is it even possible? Thanks.
from Angular module fabric
No comments:
Post a Comment