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

2.4k views Asked by At

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'

enter image description here

2

There are 2 answers

0
Sampath On BEST ANSWER

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/[email protected] --save

You can read more about it on Git

0
Günter Zöchbauer On

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.