Communicating data over HTTP
Before we dive deeper into describing what the Angular built-in HTTP client is and how to use it to communicate with servers, let's talk about native implementations of HTTP first. Currently, if we want to communicate with a server over HTTP using JavaScript, we can use the XMLHttpRequest object. This contains all the necessary methods to establish a connection with a server and start exchanging data. You can see an example of how to fetch data in the following code:
const request = new XMLHttpRequest();
request.addEventListener("load", () => {
  if (request.readyState === 4 && request.status === 200) {
    console.log(request.responseText);
  } else {
    console.log('An error has occurred');
  }
});
request.open("GET", url);
request...