小编Adn*_*urt的帖子

类型'Http'的参数不能分配给Ionic ngx-translate中'Http'类型的参数

我正在开发一款Ionic 2移动应用,并希望使用ngx-translate功能.在本教程之后,我将在app模块中导入必要的文件,如下所示:

import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpModule, Http } from '@angular/http';
...

export function createTranslateLoader(http: Http) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
Run Code Online (Sandbox Code Playgroud)

这给出了错误:

 Argument of type 'Http' is not assignable to parameter of type 'Http'.
 Property 'handler' is missing in type 'Http'
Run Code Online (Sandbox Code Playgroud)

我认为ngx-translate预期的包装不匹配,但我无法弄清楚是什么以及如何.我的@ angular/http版本是4.3.2有谁知道该怎么办?

http ionic-framework ngx-translate

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

http ×1

ionic-framework ×1

ngx-translate ×1