I am currently working on implementing a ConfigService to retrieve the appropriate configuration for each environment within the project. However, I have run into an issue with cyclic dependencies.
(index):28 Error: (SystemJS) Provider parse errors:
Cannot instantiate cyclic dependency! Http: in NgModule AppModule
Error: Provider parse errors:
Upon examining the code, it seems that the problem lies within the following components:
CustomHttp
constructor(backend: XHRBackend, options: RequestOptions, public spinnerService: SpinnerService, public exceptionService: ExceptionService, public configService: ConfigService)
ExceptionService
constructor(private _notificationService: NotificationService, private _spinnerService: SpinnerService, private _configService: ConfigService, private _router: Router)
ConfigService
constructor(private http: Http) {}
It is evident from this diagram (though not very well organized) that there are cyclic dependencies present:
https://i.sstatic.net/MkLp8.png
My main concern now is how to resolve this issue. I have heard about using Injector
, but I am unsure if it is applicable in this particular scenario.
Thank you in advance for your assistance.