我正在開發一個Ionic 2移動應用程序,並且想要使用ngx-translate功能。 在介紹之後,我輸入必要的文件在應用模塊是這樣的:類型'Http'的參數不能分配給離子類型'Http'的參數ngx-translate
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');
}
這給錯誤:
Argument of type 'Http' is not assignable to parameter of type 'Http'.
Property 'handler' is missing in type 'Http'
我認爲這是由預計的程序包不匹配NGX,但翻譯我無法弄清楚什麼和如何。我的@ angular/http版本是4.3.2 有沒有人知道該怎麼做?
你的建議爲我工作。謝謝!!! –
像魅力一樣工作,應該被接受爲答案。 –
這應該是被接受的答案。工作過,謝謝。 –