I have textarea where user can enter multiple source:Ids separated by comma;i need to iterate through each source:Id and validate each of them and highlight only the wrong source:Id formats in red font. I wrote a ng-change fn which iterates through all the inputs and give me the incorrect one. Any idea how to change the font color for that wrong input from controller?
$scope.memberArray = $scope.memberList.split(",");
for (var i = 0; i < $scope.memberArray.length; i++) {
$scope.memberIDArray = [];
//validate source:Id format
if ($scope.memberArray[i].match(format)) {
continue;
} else {
//TODO change the $scope.memberArray[i] element font color to red
//so that it highlights in red in the html
}
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<textarea autofocus ng-model="memberList" rows="8" cols="80"
ng-change="checkInput()"></textarea>