问题
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