After fetching JSON data, I am utilizing angular JS to present it in a table.
The table consists of multiple rows that are populated from the JSON file using ng-repeat
.
The value for Status.winner
can either be 0 or 1.
If the winner's value for a particular row is 0, I want to emphasize Playerdata[0].playername
for that row by highlighting it in yellow.
Conversely, if the winner's value for the row is 1, then I intend to highlight Playerdata[1].playername
in yellow color for that specific row.
I need assistance in achieving this highlighting effect for each row with varying winner values of 0 and 1.
<body ng-app="form-input" ng-controller="ctrl">
<table class="table table-bordered table-condensed ">
<caption>Recent Game Statistic</caption>
<tbody>
<tr class="success" ng-repeat="status in recentGame">
<td ng-bind="status.Winner"> </td>
<td ng-bind="status.Playerdata[0].Playername"> </td>
<td ng-bind="status.Playerdata[1].Playername"> </td>
</tr>
var app2 = angular.module('form-input', []);
app2.controller('ctrl', function($scope,$http) {
var url = "http://...JSON";
$http.get(url).success( function(data) {
$scope.recentGame = data.RecentGames;
});
})