Angular 5 Http Interceptors error when injecting service

后端 未结 8 919
北海茫月
北海茫月 2021-02-05 05:43

I am receiving the following strange dependency injection behavior when using custom HttpInterceptors in angular 5+.

The following simplified code works fine:

         


        
8条回答
  •  醉梦人生
    2021-02-05 06:21

    If in case, service class is declared in the same file of Injector class then service class should be declared and defined first. Followed by the Injector class where the service class injected as a dependency.

    Following above structure does resolves the problem in my case.

提交回复
热议问题