Related questions
Catching errors in Angular HttpClient
I have a data service that looks like this:
@Injectable()
export class DataService {
baseUrl = 'http://localhost'
constructor(
private httpClient: HttpClient) {
}
get(url, params): Promise<Object> {
return this.sendRequest(this.baseUrl + url, 'get', null, params)
.map((res) => {
return …
Adding a HTTP header to the Angular HttpClient doesn't send the header, why?
Here is my code:
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
logIn(username: string, password: string) {
const url = 'http://server.com/index.php';
const body = JSON.stringify({username: username,
password: password});
const headers = new HttpHeaders();
headers.set('Content-Type', …
Angular 4 HttpClient Query Parameters
I have been looking for a way to pass query parameters into an API call with the new HttpClientModule's HttpClient and have yet to find a solution. With the old Http module you would write something like this.
getNamespaceLogs(logNamespace) {
// …