Complete the code to import HttpClientModule in the Angular module.
import { [1] } from '@angular/common/http';
You need to import HttpClientModule from '@angular/common/http' to use HTTP services in Angular.
Complete the code to add HttpClientModule to the imports array in the Angular module.
@NgModule({
imports: [[1]],
})
export class AppModule {}You must add HttpClientModule to the imports array to enable HTTP features in your Angular app.
Fix the error in the code by completing the import statement correctly.
import { HttpClient } from '[1]';
The HttpClient service is imported from @angular/common/http, not from deprecated or unrelated packages.
Fill both blanks to complete the Angular module setup for HTTP.
@NgModule({
imports: [BrowserModule, [1]],
providers: [[2]]
})
export class AppModule {}You add HttpClientModule to imports and HttpClient to providers if you want to inject it manually (though usually just importing the module is enough).
Fill all three blanks to complete the Angular service using HttpClient.
import { Injectable } from '@angular/core'; import { [1] } from '@angular/common/http'; @Injectable({ providedIn: 'root' }) export class DataService { constructor(private [2]: HttpClient) {} getData() { return this.[3].get('/api/data'); } }
You import HttpClient, inject it with a variable name like httpClient, and call httpClient.get() to fetch data.