Currently, I am retrieving the status code in my service using the following code snippet:
add(new: Add): Observable<Response> {
return this.http
.post(this.addURL, new , httpOptions)
.map((response: Response) => {
if (response) {
if (response.status === 200) {
return [{ status: response.status, response: <Response>response.json() }]
}
}
})
.catch(this.handleError);
}
In my component.ts file, I am attempting to trigger a list update after successfully adding a new item. Below is the relevant section of my code:
addDetails(): void {
var new = this.form.value.array;
new = JSON.stringify(this.form.value.array);
this.addService.add(new)
.subscribe(
resultArray => this.Response = resultArray,
error => console.log("Error :: " + error),
)
if(Response.status ===200){
this.getList();
}}
However, I encounter the following error message: Property 'status' does not exist on type 'typeof Response'