DEV Community

Lalarukh khan
Lalarukh khan

Posted on

 

HttpErrorResponse {headers: HttpHeaders, status: 0, statusText: 'Unknown Error', url: 'my_url', ok: false, …}

Hey there,
I'm trying to get response from POST_API. But I can't get that inside my component.ts
Here's my code:

roomtypes: any;
  errorMessage: String = "";
  ngOnInit(): void {
    this.http.post<any>('https://backend.revroo.io/api/v1/booking-engine/get-hotels', { title: 'Angular POST Request Example' }).subscribe({
        next: roomtype => {
            this.roomtypes = roomtype.id;
        },
        error: error => {
            this.errorMessage = error.message;
            console.error('There was an error!', error);
        }
    })
  }
Enter fullscreen mode Exit fullscreen mode

Image description
Seeking Help!

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.