Angular接收一个对象并将其填入页面

时间:2015-11-06 15:15:45

标签: java angularjs

嗨朋友我有一个应该很容易修复的问题,但我找不到解决方案,我想填写一个来自AjaxController的类中的对象的一些信息,需要回到Ajax 。但所有这些都需要在网站上发生。

班级是:

public class ContractSummary {

private String defaultSaId;
private Map<String, Contract> saIdMap;
private CustomerInformation customer;

因此,CustomerInformation中的信息类似于String name, String address ...,并且地图会自动生成。

因此UI在接收我想要填充CustomerInformation的对象时。我做这样的事情:

$scope.addCustomer = function() {
  if ($scope.customerName && $scope.customerAddressOne && $scope.customerCity && $scope.customerCountry) {
    $scope.invalidCustomer = false;
    $scope.validCustomer = true;
    $scope.requestView.customerOrgSiteName = $scope.customerName;
    $scope.requestView.customerOrgSiteAddress = $scope.customerAddressOne;
    $scope.requestView.customerOrgSiteCity = $scope.customerCity;
    $scope.requestView.customerOrgSiteCountry = $scope.customerCountry;
    $scope.requestView.customerOrgSiteAddress = $scope.requestView.customerOrgSiteAddress + " " + $scope.customerAddressTwo;
    $scope.requestView.customerOrgSiteState = $scope.customerState;

    // Add Information in the
    // ContractSummary

    $scope.contracSummary.customer.name = $scope.customerName;
    $scope.contracSummary.customer.address = $scope.customerAddressOne;
    $scope.contracSummary.customer.addressTwo = $scope.customerAddressTwo;
    $scope.contracSummary.customer.city = $scope.customerCity;
    $scope.contracSummary.customer.state = $scope.customerState;
    $scope.contracSummary.customer.country = $scope.customerCountry;
    $scope.contracSummary.customer.postCode = $scope.customerPostCode;
  } else {
    $scope.invalidCustomer = true;
    $scope.validCustomer = false;
  }
};

当我将对象contracSummary发送回Ajax时,在客户端收到null。我无法看到这是如何运作的。关于它的任何想法?

谢谢!

0 个答案:

没有答案