Issue
I'm working with spring boot and angular and I passed as a parameter in get request in the body
@GetMapping("/parAdresse")
public List<Object> parAdresse(@RequestBody String adresse) {
return dis.finddis(adresse) ;
}
How I can do the same in the front?
pieChart(add: string) {
return this.http.get("http://localhost:9095/distri/parAdresse");
}
Solution
backend
@GetMapping("/parAdresse")
public List<Object> parAdresse( @RequestParam String adresse) {
return dis.finddis(adresse) ;
}
front
pieChart(add: string) {
let queryParams = new HttpParams();
queryParams = queryParams.append("adresse","TUNIS");
return this.http.get("http://localhost:9095/distri/parAdresse", {params:queryParams});
}
Answered By - Mariem KAROUI
Answer Checked By - Marilyn (JavaFixing Volunteer)