Cannot find module @angular/common/http Ionic 3 app

被刻印的时光 ゝ 提交于 2019-12-12 04:18:11

问题


I have done the Ionic 3 app's internationalization using ngx-translate.It gave me below error.

I have done that using official doc here.

Cannot find module '@angular/common/http'


回答1:


The issue was @angular/common/http is only available in angular 4.3+.But on Ionic 3 we're using Angular 4.1.3.

So this is the solution:

I have removed @ngx-translate/http-loader

npm uninstall @ngx-translate/http-loader --save

And add an older version of it:

npm i @ngx-translate/http-loader@0.1.0 --save

You can read more about it on Git




回答2:


HttpClient was introduced in Angular 4.3.0, you are using 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.



来源:https://stackoverflow.com/questions/46077427/cannot-find-module-angular-common-http-ionic-3-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!