Here is the full declaration of the nested module
the source file we have three declared modules
//BaseCoreModule
@NgModule({
...
import:[
...
OAuthModule, // has the service that I want to replace by my own
...
]
...
})
export class BaseCoreModule {}
//RootCoreModule
@NgModule({
exports: [BaseCoreModule, LocalizationModule],
imports: [
BaseCoreModule,//notice
...
OAuthModule.forRoot(), // OAuthModule is imported again using forRoot()
...
],
})
export class RootCoreModule {}
// CoreModule will be imported to the AppModule
@NgModule({
exports: [BaseCoreModule],
imports: [BaseCoreModule],
})
export class CoreModule {
static forRoot(options = {} as ABP.Root): ModuleWithProviders<RootCoreModule> {
return {
ngModule: RootCoreModule,
providers: [...other providers...]
}
}
}
The CoreModule is imported in my AppModule using forRoot() function. What I want to do is to replace (override) a service provided in the OAuthModule which is deeply imported by the CoreModule without the necessity to use conventional methods (e.g. using source code instead of npm lib)