Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS与Restful Java;MySQL_Java_Angularjs_Rest - Fatal编程技术网

AngularJS与Restful Java;MySQL

AngularJS与Restful Java;MySQL,java,angularjs,rest,Java,Angularjs,Rest,我使用MySQL数据库将AngularJS与RESTfulWebService结合使用。我从查看页面将数据输入数据库。但我的问题是,我不能用函数求和。请帮帮我 Table+JAR: 视图+web+Bean+控制器: 您需要返回函数中的值: $scope.currentAssetSum = function(){ return $scope.currentAssetsData.cash_hand + $scope.currentAssetsData.bank_account; } 您应该像

我使用MySQL数据库将AngularJS与RESTfulWebService结合使用。我从查看页面将数据输入数据库。但我的问题是,我不能用函数求和。请帮帮我

Table+JAR:

视图+web+Bean+控制器:

您需要返回函数中的值:

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

您应该像这样在函数中放置return语句

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

As
CurrentAssetData
是一个数组。因此,您必须像这样修改您的计算语法

$scope.currentAssetSum = function (){
    return $scope.currentAssetsData.cash_hand+$scope.scope.currentAssetsData.bank_account;
}
$scope.currentAssetsData['cash_hand'] + $scope.currentAssetsData['bank_account']
然后您需要在函数中返回结果:

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

到底哪一部分不起作用?原因是什么?
$http
请求是否成功?
响应。数据是否包含您想要的值?复制代码,而不是屏幕截图。是否检查了我的答案?