angular http params code example

Example 1: angular http request query params

request(query) {
  let params = new HttpParams().set("keyword", query);
  return this.http.get(`Your_URL`, {params});
}

Example 2: angular httpclient query params not working

getLogs(logNamespace): Observable {

    // Setup log namespace query parameter
    let params = new HttpParams().set('logNamespace', logNamespace);

    return this._HttpClient.get(`${API_URL}/api/v1/data/logs`, { params: params })
}

Example 3: router params angular

// Navigate and send Params
this.router.navigate(['/users/edit/', user.id]);

Tags:

Misc Example