HttpClient is used to interact with REST APIs. It supports GET, POST, PUT, DELETE requests.
import { HttpClientModule } from '@angular/common/http';
this.http.get('https://api.example.com/users')
.subscribe(data => console.log(data));
this.http.post('/api/user', userData)
.subscribe(response => {...});
this.http.get('/api/data').subscribe({
next: data => {},
error: err => console.error(err)
});
Take quizzes related to this topic and see where you stand!
Start Quiz Now