Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.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
Javascript 金额可';当angularjs中的数量或单价发生变化时,不进行更新_Javascript_Html_Angularjs - Fatal编程技术网

Javascript 金额可';当angularjs中的数量或单价发生变化时,不进行更新

Javascript 金额可';当angularjs中的数量或单价发生变化时,不进行更新,javascript,html,angularjs,Javascript,Html,Angularjs,我想在更改数量或单价时更新金额。正常情况下,它是工作的,但当我改变金额的价值,然后再次改变数量或单价。在这种情况下,金额不会在UI中更新。 尽管该值已在控制台中更新。它不能仅在UI中更新 我使用ng change调用函数。 我使用的是动态表,值是从多维数组绑定的 $scope.GetItemValueForAmountCalculation=函数(项目名称、行、索引){ var itemType=typeof(itemName); var项目; if(itemType!=编号和行长度-3>=索

我想在更改数量或单价时更新金额。正常情况下,它是工作的,但当我改变金额的价值,然后再次改变数量或单价。在这种情况下,金额不会在UI中更新。 尽管该值已在控制台中更新。它不能仅在UI中更新

我使用ng change调用函数。 我使用的是动态表,值是从多维数组绑定的

$scope.GetItemValueForAmountCalculation=函数(项目名称、行、索引){
var itemType=typeof(itemName);
var项目;
if(itemType!=编号和行长度-3>=索引){
var itemName filtered=itemName.toString().replace(/\D/g,“”);
item=编号(itemNameFiltered);
}
否则{
项目=项目名称;
}
如果($scope.insertItemCount==未定义){
如果(索引>=行长度-3){
如果($scope.distCount==1){
$scope.Qty=物料;
$scope.QtySumForItem+=项目;
$scope.distCount++;
}else if($scope.distCount==2){
$scope.UnitPrice=项目;
$scope.UnitpriceSumForItem+=项目;
$scope.distCount++;
}else if($scope.distCount==3){
$scope.Amount=$scope.Qty*$scope.UnitPrice;
$scope.AmountSumForItem+=$scope.Amount;
$scope.distCount++;
}
}
如果($scope.distCount==4){
$scope.ItemTableFooter[$scope.ItemTableFooter.length-3]=$scope.QtySumForItem;
$scope.ItemTableFooter[$scope.ItemTableFooter.length-1]=$scope.AmountSumForItem;
$scope.distCount=1;
}
}
};
$scope.GetChengedFieldValue=函数(项目名称、行、索引){
var qtyType=typeof(行[row.length-3]);
var unitPriceType=typeof(行[row.length-2]);
var amountType=typeof(行[row.length-1]);
如果(qtyType!=编号){
var data=row[row.length-3].toString().replace(/\D/g,“”);
行[row.length-3]=编号(数据);
}
if(单价类型!=编号){
var data=row[row.length-2].toString().replace(/\D/g,“”);
行[row.length-2]=编号(数据);
}
如果(数量类型!=数量){
var data=row[row.length-1].toString().replace(/\D/g,“”);
行[row.length-1]=编号(数据);
}
var项目;
if(row.length-3=(row.length-3)){
行[索引]=项目;
}
否则{
行[索引]=项目;
}
行[row.length-1]=行[row.length-3]*行[row.length-2];
$scope.AmountSumForItem+=行[row.length-1];
$scope.QtySumForItem+=行[row.length-3];
}
否则{
$scope.AmountSumForItem-=行[row.length-1];
行[索引]=项目;
$scope.AmountSumForItem+=项目;
}
$scope.ItemTableFooter[$scope.ItemTableFooter.length-1]=$scope.AmountSumForItem;
$scope.ItemTableFooter[$scope.ItemTableFooter.length-3]=$scope.QtySumForItem;
angular.forEach($scope.invoiceDetailList,函数(invoiceDetail){
if(invoiceDetail.SalesOrderId==行[0]&&invoiceDetail.ItemId==行[1]){
invoiceDetail.ItemName=行[3];
invoiceDetail.DescriptionOne=行[4];
invoiceDetail.Quantity=行[row.length-3];
invoiceDetail.UnitPrice=行[row.length-2];
invoiceDetail.Amount=行[row.length-1];
}
});
}

{{h}
{{item}}
{{f}}