I'm newer in angular js and I would like to call the web-service (implemented with Spring REST ) which use multiple data in his request body but i didn't now how the parsing can be done. Can someone help me please ?
This is my Spring method in controller:
@RequestMapping(value = "/addpost", method = RequestMethod.POST, headers = "Accept=application/json")
public @ResponseBody String addpost(@RequestBody PostDto post, @RequestBody UserDto user) {
postservice.addPost(post, user);
return "post inserted";
}
This is how i tried to call this method
$scope.addPost=function(x,y){
$http.post('http://localhost:8080/wall/addpost',[x,y]).
success(function(data, status, headers, config) {
$scope.persons.push(data);
$scope.user="";
$scope.post="";
}).
error(function(data, status, headers, config) {
alert("erreur");
})
Aucun commentaire:
Enregistrer un commentaire