Angular 2 HttpBackend与Http不兼容

Angular 2 HttpBackend与Http不兼容,angular,typescript,karma-jasmine,Angular,Typescript,Karma Jasmine,您好,我有一个提供商正在使用: 构造(http:http,myService:myService,events:events) 在我的单元测试中,我正在调用 provider=新的myProvider(HttpBackend、MyService、事件) 我得到以下信息: TS2345: Argument of type 'typeof HttpBackend' is not assignable to parameter of type 'Http'. 类型“typeof HttpBack

您好,我有一个提供商正在使用:

构造(http:http,myService:myService,events:events)

在我的单元测试中,我正在调用

provider=新的myProvider(HttpBackend、MyService、事件)

我得到以下信息:

  TS2345: Argument of type 'typeof HttpBackend' is not assignable to parameter of type 'Http'.

类型“typeof HttpBackend”中缺少属性“\u backend”。

您必须使用
@angular/common/http
中的
HttpClient
,而不是
http
,并且忘记在
app.module.ts中不包括
HttpClientModule


从'@angular/common/http'导入{HttpClientModule,HttpClient}

在测试文件或实际提供者中?添加到所有位置