I am trying to send query parameters with a get request. This code always has an empty query {}. What am I missing?
let p = new HttpParams().set('Test', "7878");
return this.http
.get<Response>(environment.baseAPIUrl + route,
{
withCredentials: false,
headers: requestHeaders,
params: p,
responseType,
observe: observe as 'body'
}
);
Basically your use of HttpParams
seems okay and it's working for me.
Open my Stackblitz Example :
just note, that the error-message (1) will not include the url-parameters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.