0

I have recently migrated the application from angular version 4 to 12. Some of my modules are making http calls through below implementation and they are not working. Basically it should load the data when a modal is opened up!! But right now when i click on any id it just opens the blank modal but no http calls are triggering and my network tab is empty. This issue is happening with modules this kind of implementation only and all other modules are working fine.

Code snippet:

`export class XYZModule {
static forRoot(config: ABCConfig): ModuleWithProviders<XYZModule> {
return {
ngModule: XYZModule,
providers: [
{provide: ABCConfig, useValue: config}
],
};
}

    constructor (@Optional() @SkipSelf() parentModule: XYZModule) {
        if (parentModule) {
            throw new Error('XYZModule is already loaded.  Import it in the root module only.');
        }
    }

}

Note:  This module called at other parentmodule like this
@NgModule({
imports:[
xYZModule.forRoot({ApiConfig: ApiConstant.data}),]
})
`

Here in ApiConstant.data I have configured all the api end points need to be done based on the operation.

I have updated the code with latest ModuleWithProviders<XYZModule> but still it is not working!! I would like to if anyone faced with similar issue or do I need to change any implementation regarding calling this modules.

0 Answers0