Within my perspective, I possess a collection of different statuses.
<ul>
<li>FIRST_STATUS</li>
<li>SECOND_STATUS</li>
<li>THIRD_STATUS</li>
</ul>
To continuously update the statuses in my controller model, I use the following function:
$interval(function () {
$scope.bad_statuses = Model.getStatuses({id: $scope.someModel.id});
}, 1000);
The $scope.statuses
array contains the list of bad statuses, such as $scope.bad_statuses[0]
= FIRST_STATUS
. If a status exists within $scope.bad_statuses
, I want to color it red; otherwise, it should be green.
In essence, I need to extract each value from the <li>
elements and based on whether it is present in the $scope.bad_statuses
array, assign either a red or green color.
How would you suggest tackling this issue? I am new to AngularJS.