Я перепробовал все, что мог придумать, и все выглядит правильно, я' Надеюсь, вы подскажете мне, в чем может быть проблема.
This is my js:
$scope.toggleStockOrderDetails = function (index) {
// Check if the index is within the bounds of the array
if (index < 0 || index >= $scope.AgreementStockOrders.length) {
console.error('Invalid index:', index);
return;
}
console.log('Before toggle:', $scope.showDetails[index]);
// Toggle the visibility of the details section
$scope.showDetails[index] = !$scope.showDetails[index];
// Check if the details for this item have not been fetched yet
if (!$scope.AgreementStockOrders[index].stockOrderDetails) {
// Create an empty stockOrderDetails array if it doesn't exist
$scope.AgreementStockOrders[index].stockOrderDetails = [];
// Call the GetStockOrderDetails function to fetch the details
var productCode = $scope.AgreementStockOrders[index].ProductCode;
AgreementsService.GetStockOrderDetails(productCode).then(function (response) {
// Store the details in the corresponding item in AgreementStockOrders array
$scope.AgreementStockOrders[index].stockOrderDetails = response.data;
}, function (error) {
console.error('Error fetching stock order details: ', error);
});
}
console.log('After toggle:', $scope.showDetails[index]);
};
А ниже мой HTML:
Stock Order Detail
Product code
Barcode
Description
PA Stock Required
DC SOH
Store SOH
Order Qty
Order Value
{{ item.ProductCode }}
{{ item.Barcode }}
{{ item.Description }}
{{ item.PAStockRequired }}
{{ item.DcSoh }}
{{ item.StoreSoh }}
{{ item.OrderQty }}
{{ item.OrderValue | number:2 }}
Store code
Store name
PA Stock Required
DC SOH
Store SOH
Weekly Mvmt
Order Qty
Order Value
Comments
{{ detail.StoreId }}
{{ detail.StoreName }}
{{ detail.PAStockRequired }}
{{ detail.DcSoh }}
{{ detail.StoreSoh }}
{{ detail.RateOfSale }}
{{ detail.OrderValue | number:2 }}
Save
Total:
{{ total}}
Подробнее здесь: https://stackoverflow.com/questions/783 ... in-angular
Мобильная версия