I'm getting an error Cannot find module '@angular/http/src/static_response' or its corresponding type declarations
from my Angular v12 project when I try to use the import statement in my code: import { Response } from "@angular/http/src/static_response";
. This statement was working perfectly fine in my Angular v4 project:
getClientMasterData(): Observable<any> {
return this.http.get(x.getBaseURL() "/ClientMaster/GetMasterData", this.getHeader.get())
.pipe(map((response: Response) => <MasterDataModel[]>response.json())
,catchError(this.handleError));
}
While I know that http
has been moved to @angular/common
, I don't see neither src
folder nor static_response
file inside @angular/common
.
Can someone please help?
CodePudding user response:
You'll need to do following changes:
- Replace
import { Response } from "@angular/http/src/static_response";
withimport { HttpResponse } from "@angular/common/http";
- Replace
response: Response
withresponse: HttpResponse<MasterDataModel[]>
.