Angular 4: Cannot instantiate cyclic dependency! InjectionToken_HTTP_INTERCEPTORS

后端 未结 3 1191
生来不讨喜
生来不讨喜 2020-12-18 22:30

I know, this question may sound duplicate and I have tried everything found on stackover flow unable to resolve this problem, so please bear with me

To make

3条回答
  •  孤城傲影
    2020-12-18 22:44

    Use setTimeout() function in constructor to assign service.

    constructor(private injector: Injector) {
      setTimeout(() => {
          this.loginService = this.injector.get(LoginService);
      })
    }
    

    Try this and revert back if you face any issue.

提交回复
热议问题