0
如何在AngularJS中更改ng-repeat
中的文本框的CSS?我正在使用它進行驗證。我在更新文本框CSS時,它是空白的。我所嘗試過的不起作用。如何在AngularJS中動態地添加ng-repeat中的文本框的CSS
這是我的代碼,看看。
CSS:
.manytooneproductcss {
border: 1px solid #ff0000;
}
HTML:
<table cellpadding="5" cellspacing="0" data-ng-repeat="Item in ProductList" data-ng-cloak>
<tr>
<td style="vertical-align:top" class="massWidthCls">
<span mass-autocomplete>
<input ProductID="{{Item.ProductID}}" type="text" data-ng-model="Item.SelectedSourceLocationIdManyToOne" mass-autocomplete-item="ac_options__source_location_ManyToOne" placeholder="Type in or scan a location name" data-ng-init="SelectedSourceLocation = dirty.value" data-ng-change="resetControlManyToOne()" class="manytooneproductcss">
</span>
</td>
</tr>
</table>
<div>
<div data-ng-click="SaveandContinue();">Save</div>
</div>
JS:
$scope.SaveandContinue = function() {
angular.forEach($scope.ProductList, function (key) {
console.log(key.SelectedSourceLocationIdManyToOne)
if (keepGoing) {
if (key.SelectedSourceLocationIdManyToOne == "" || key.SelectedSourceLocationIdManyToOne == undefined || key.SelectedSourceLocationIdManyToOne == NaN) {
toastr["error"]("Please Enter Source Location for Added Line Item !")
keepGoing = false;
}
}
});
if ($scope.selectedTransferMode.Value == 3 && $scope.selectedTransferType.Value == 1) {
var ProductList = $scope.ProductList;
for (var i = 0; ProductList.length > i; i++) {
var productId = ProductList[i].ProductID;
var LocationID = $scope.selectedTransferMode.Value == 3 ? selectedSourceLocationIds[ProductList[i].SelectedSourceLocationIdManyToOne] : $scope.SelectedSourceLocationId;
if (LocationID <= 0 || LocationID == undefined || LocationID == NaN || LocationID == null) {
toastr["error"]("Please Enter Source Location for Added Line Item !")
keepGoing = false;
}
}
}
// others logic
}