I am new in angularJS. i am creating registration task. here if i am sending individual attribute. getting success message. but i am try to send object as json.
but getting below error
Failed to load resource: the server responded with a status of 404 (Not Found)
Client side code
function registration(user) {
var employee={
name:user.firstName+" "+user.lastName,
email:user.emailAddress,
password:user.password
};
var data = JSON.stringify(employee);
$http.post('http://localhost:8080/AngularJSSpring/ajax/register', data
).success(
function(data, status) {
defer.resolve(data);
});
return defer.promise;
}
server side code (spring mvc)
@RequestMapping(value = "/ajax/register", method = RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public JSONResponse registration(@RequestBody Employee emp) {
System.out.println("ajax register");
return angularView.registration(emp);
}
i also try by modifiying
$http.post('http://localhost:8080/AngularJSSpring/ajax/register', employee)
but not working.. please help me for this