【问题标题】:AngularJS with Restful Java & MySQLAngularJS 与 Restful Java & MySQL
【发布时间】:2016-12-30 06:00:06
【问题描述】:

我使用 AngularJS 和使用 MySQL 数据库的 RESTful WebService。我从视图页面将数据输入数据库。但我的问题是 - 我无法总结功能。请帮帮我...

表+JAR: enter image description here

视图+web+Bean+控制器: enter image description here

【问题讨论】:

  • 复制这里的代码而不是屏幕截图。
  • 你检查我的答案了吗?

标签: java angularjs rest


【解决方案1】:

因为currentAssetsData 是一个数组。所以,你必须像这样修改你的计算语法。

$scope.currentAssetsData['cash_hand'] + $scope.currentAssetsData['bank_account']

然后你需要在函数中返回结果:

$scope.currentAssetSum = function(){
  return $scope.currentAssetsData['cash_hand'] + $scope.currentAssetsData['bank_account'];
}

【讨论】:

    【解决方案2】:

    您需要返回函数中的值:

    $scope.currentAssetSum = function(){
      return $scope.currentAssetsData.cash_hand + $scope.currentAssetsData.bank_account;
    }
    

    【讨论】:

    • 究竟哪一部分不起作用?原因是什么? $http 请求是否成功? response.data 是否包含您想要的值?
    【解决方案3】:

    你应该像这样把return语句放在函数里面。

    $scope.currentAssetSum = function (){
        return $scope.currentAssetsData.cash_hand+$scope.scope.currentAssetsData.bank_account;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-06
      • 2016-08-12
      • 2012-03-13
      • 2015-10-14
      • 2015-07-08
      • 1970-01-01
      相关资源
      最近更新 更多