Interview Questions

1. What is HttpClient, and what are its advantages of it?

Most front-end applications use either XMLHttpRequest interface or the fetch() API to communicate with backend services over HTTP protocol. For the same purpose, Angular provides a simplified client HTTP API known as HttpClient. This is based on top of the XMLHttpRequest interface. This HttpClient is available in the @angular/common/http package, which you can import into your root module as follows:

import { HttpClientModule } from '@angular/common/http';  

Following are some of the crucial advantages of HttpClient:

  • HttpClient contains testability features.
  • It provides typed request and response objects.
  • It can intercept requests and responses.
  • It supports Observalbe APIs.
  • HttpClient also supports streamlined error handling.
By Md Riyazuddin 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started


Leave a Comment

Check out more interview questions

Based on your skills

MS SQL Server

1433413 1720 18 859


35898 92 0 46


28189 72 1 36