Greetings! I have utilized this tag to modify my CSS style based on a condition where totalAsset and sortedAsset are equal.
<div class="table-row" ng-repeat="x in myData"
ng-model="sort(x.totalAsset)"
ng-class="{'lightblue': x.totalAsset == sortedAsset}">
The data for totalAsset is structured as follows:
$scope.myData = [
{
totalAsset: "23557"
},
{
totalAsset: "4512190",
},
{
totalAsset: "2190",
},
{
totalAsset: "1256790",
}
]
I have implemented a function that automatically sorts the totalAsset values.
$scope.sort = function(totalAsset) {
$scope.unsortedAsset = totalAsset;
$scope.sortedAsset = $scope.unsortedAsset.split("").sort().join("");
console.log(sortedAsset);
}
According to the logic, only the first and last rows should turn blue, while the other two rows remain unchanged.
However, I am facing an issue where only the last row turns blue, whereas the first one does not. Any suggestions on how to resolve this?