How to return sample json data in response instead of calling actual API. I want to test my UI code without actually calling backend API .I have response data captured from UAT I have added this in my service and put json file in same folder.
getdata(): Observable<any>{
return this.http.get<any>('keyinfoResponse.json')
.pipe(map((data)=>data),catchError((error)=>throwError(error)));
}
and in component
this.dataService.getdata().subscribe((response) => {
this.keyInfoResponse = response;
}, (error) => {
this.hasErrorOccurred = true;
if (error.message) {
this.errorMessage = error.message;
}
});
}
the response is undefined.