I called the getUser
in my app angularJS with Restangular service
Controller.java
:
@RequestMapping("/user")
public List<User> getUser(@ModelAttribute User user){
List<User> list = new ArrayList<User>();
list.add(user);
return list;
}
and in the angularJs :
var listUser= Restangular.all('path/user');
var getMutafeUtente = function(){
return listUser.getList().$object;
}
runing the app i could enter to the getUser method and my user is setted perfectly in the list.
But arriving in angular with an empty list.
I tried with other method that uses the same logic and worked.
The only difference is that in getUser method there is the @ModelAttribute
.
How can i pass attribut in session to AngularJs controller and then to my html page?