AngularJS与Restful Java;MySQL
我使用MySQL数据库将AngularJS与RESTfulWebService结合使用。我从查看页面将数据输入数据库。但我的问题是,我不能用函数求和。请帮帮我 Table+JAR: 视图+web+Bean+控制器: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; } 您应该像
您需要返回函数中的值:
$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
请求是否成功?响应。数据是否包含您想要的值?复制代码,而不是屏幕截图。是否检查了我的答案?