I'm trying to pass query parameters inside a service to a REST API.
Example of how i should pass to API.(EXPECTED)
http://localhost:2000/world/123456789/avengers?type=fruits&fields=_all
Have tried as below:
all(countId) {
const headers: HttpHeaders = new HttpHeaders({
"_id" : countId,
"content-type" : "application/json"
});
let params = new HttpParams();
params = params.append("type", "fruits");
params = params.append("fields", "_all");
const options = {
headers: headers,
params: params
};
return this.http.put ( "http://localhost:2000/world/123456789/avengers", options )
}
But i am not able to pass them has query parameters.how will i do that?