简体   繁体   English

找不到模块@ angular / common / http Ionic 3 app

[英]Cannot find module @angular/common/http Ionic 3 app

I have done the Ionic 3 app's internationalization using ngx-translate .It gave me below error. 我已经使用ngx-translate完成了Ionic 3应用程序的国际化,这给了我下面的错误。

I have done that using official doc here . 我已经在这里使用官方文档做到

Cannot find module '@angular/common/http' 找不到模块'@ angular / common / http'

在此处输入图片说明

The issue was @angular/common/http is only available in angular 4.3+ .But on Ionic 3 we're using Angular 4.1.3 . 问题是@angular/common/http仅在angular 4.3+可用。但是在Ionic 3我们使用Angular 4.1.3

So this is the solution: 所以这是解决方案:

I have removed @ngx-translate/http-loader 我已经删除了 @ngx-translate/http-loader

npm uninstall @ngx-translate/http-loader --save npm卸载@ ngx-translate / http-loader-保存

And add an older version of it: 添加旧版本:

npm i @ngx-translate/http-loader@0.1.0 --save npm我@ ngx-translate / http-loader @ 0.1.0-保存

You can read more about it on Git 您可以在Git上了解更多信息

HttpClient was introduced in Angular 4.3.0 , you are using 4.1.3. HttpClientAngular 4.3.0中引入,您正在使用4.1.3。

In the Angular version you are using you can inject Http (requires HttpModule in imports: [...] of AppModule ), but it has different features and a different API. 在您使用的Angular版本中,您可以注入Http (在AppModule需要HttpModule imports: [...] AppModule ),但是它具有不同的功能和不同的API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM