Hi I have a provider that is using:
construct(http: Http, myService: MyService, events:Events)
In my unit test I am calling
provider = new myProvider(HttpBackend, MyService, Events)
I am getting the following:
TS2345: Argument of type 'typeof HttpBackend' is not assignable to parameter of type 'Http'.
Property '_backend' is missing in type 'typeof HttpBackend'.
答案 0 :(得分:0)
you have to use HttpClient
from @angular/common/http
, instead of Http
and forget not to include HttpClientModule
in app.module.ts
import {HttpClientModule, HttpClient} from '@angular/common/http';