Complete the code to import HttpClientModule in an Angular module.
import { [1] } from '@angular/common/http';
You need to import HttpClientModule to use HttpClient services in Angular.
Complete the code to inject HttpClient in a service constructor.
constructor(private [1]: HttpClient) {}The common and simple variable name used is http for HttpClient injection.
Fix the error in the HTTP GET request code.
this.http.[1]('https://api.example.com/data').subscribe(data => console.log(data));
Use get method to make a GET HTTP request with HttpClient.
Fill both blanks to create a typed HTTP GET request and handle the response.
this.http.get<[1]>('url').subscribe(([2]) => console.log([2]));
Specify the expected data type User and use a variable like data to receive the response.
Fill all three blanks to add error handling to an HTTP GET request.
this.http.get('url').subscribe({ next: ([1]) => console.log([1]), error: ([2]) => console.error([2]), complete: () => console.log('[3]') });
Use data for success, err for errors, and a message like 'Request complete' on completion.
