When updating to Angular 8.x+, developers commonly encouter this type of error:
app/app.module.ts:9:42 - error TS2307: Cannot find module '@angular/http'.
9 import {HttpModule, RequestOptions} from '@angular/http';
The solution
The @angular/http
module has been removed in recent versions of Angular and replaced by @angular/common/http
. Furthermore, there are some name changes that might need manual fixing, including:
HttpModule
⇒HttpClientModule
Http
⇒HttpClient
URLSearchParams
⇒HttpParams
Note that the replacements are not always exact equivalent and hence might require some work to get working
See the official @angular/http deprecation guide for more details on how to migrate.
No comments:
Post a Comment