I am developing a spring restful application with angularjs. In Spring i am using maven and Hibernate.
I have returned json object using spring rest but i dont know how to use this object in my angular controller using $resource
Here is my spring rest controller
@RequestMapping(value = "/list", method = RequestMethod.GET)
public @ResponseBody
List<Employee> getEmployee() {
List<Employee> employeeList = null;
try {
employeeList = dataServices.getEntityList();
} catch (Exception e) {
e.printStackTrace();
}
return employeeList;
}
Here is my jsp
<body>
<h3>FirstName:</h3>
<!-- First name from json object -->
<p></p>
<h3>LastName:</h3>
<!-- Last name from json object -->
<p></p>
</body>
So please help me with angularjs controller code
My application name is: SpringRestCrud1
My path which is used to return the json object is: http://localhost:8080/SpringRestCrud1/employee/list
And my result is: [{"id":3,"firstName":"Hoston","lastName":"lindey","email":"hl@gmail.com","phone":"90908989899"}]