In my current project, I am implementing ng-repeat to showcase a collection of items. Each item includes a line number, an HTML input field for quantity input, and an itemId. I am currently exploring ways to connect the input value with the quantity field in the myItem object.
<tr ng-repeat="myItem in selectedItems track by $index">
<td>
{{ myItem.lineNumber }}.
</td>
<td>
<input type="text" size="8" ng-blur="showAllItems()" ng-bind="myItem.qty" ></input>
</td>
<td>
{{ myItem.itemId }}
</td>
</tr>
One observation is that I am using the ng-blur method to trigger the display of all items. Here is the code snippet for this method:
$scope.showAllItems = function() {
angular.forEach($scope.selectedItems, function(value,key) {
console.log("key = " + key + ", value.lineNumber = " + value.lineNumber + ", value.qty = " + value.qty + ", itemId = " + value.itemId);
});
}
Upon analyzing the output, I noticed that the qty value is not synchronizing correctly with the dataset. Can anyone offer insights on what could be causing this issue?
Appreciate your help!