how to write angular service method params to call a restful webservice Spring MVC having in its signature @RequestBody and @RequestParam together.
java code :
@RequestMapping(value = "/getChargements", method = RequestMethod.POST)
@ResponseBody
public PlanificationEtSuiviChargementDto getChargements (@RequestBody CriteriaPlanificationDto criteriaPlanificationDto,
@RequestParam boolean historique) {
LOG.info("getChargements");
return demandeChargementService.getChargementCalendrier(criteriaPlanificationDto.getParams(),
criteriaPlanificationDto.getStep(), criteriaPlanificationDto.getPage(), historique);
}
Angular service method :
public getPlanification(criteria: Criteria, step: number, page: number,historique: boolean): Observable<PlanificationData> {
return this.http.post(this.config.getIp() + 'chargements/getChargements.html/',
{ 'params': criteria, 'step': step, 'page': page },historique,
this.http.getJsonOptions()).pipe(map((rep: Response) => rep.json()));
}
i will be grateful if you help me. have a nice day!