我是一个非常新的angularjs面临一些问题来发布对象列表,其中包含了一组对象.Below是我的后端bean对象结构:
public class UserBean{
private String userName;
private Set<ContactBean> contactBean= new HashSet<ContactBean>();
private Set<LocationBean> locationBean= new HashSet<LocationBean>();
//getter and setter over here
}
public class ContactBean{
private String contactName;
private String contactPhone;
private String contactEmail;
//getter and setter over here
}
public class LocationBean{
private String country;
private String state;
private String city;
//getter and setter over here
}
我的控制器结构是,
@RequestMapping(value = "/addUser", method = {RequestMethod.POST })
public @ResponseBody String addUser(@RequestBody UserBean userBean){
return "";
}
我的角度js脚本是
var response = $http.post("addUser", JSON.parse(JSON.stringify($scope.userBean,$scope.contactBean,$scope.locationBean,)), config);
我正在设置我的数据-ng模型
data-ng-model="userBean.userName"
data-ng-model="contactBean.contactName"
data-ng-model="locationBean.country"
如何将联系人和位置bean对象设置为UserBean。任何帮助将非常感激。