Angular 5 Http Interceptors error when injecting service

后端 未结 8 944
北海茫月
北海茫月 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:22

    Update on end of January 2018

    Angular Team resolved this issue in Angular 5.2.3 released 31 January 2018. After updating angular version you will be able to inject services that use HTTPClient as normal in constructor

    Bug Fixes

    common: allow HttpInterceptors to inject HttpClient (#19809) (ed2b717), closes #18224

    from Angular changelog

提交回复
热议问题