I want to provide a different background color for the angular ng-repeat in the table design format. If play_id is same I want to provide same background color in tr tag else another color tr tag.
JSON (https://jsfiddle.net/0sasz78n/)
{
"play_details": [
{
"play_id": "15",
"quest_id": "63",
"question": "What will be the match result ?"
},
{
"play_id": "8",
"quest_id": "61",
"question": "Which of this batswan will score higher ?"
},
{
"play_id": "8",
"quest_id": "59",
"question": "What will be the match result ?"
}
]
}
HTML code:
<table><tr ng-repeat="single_Play in all_Play_details">
<td>{{$index + 1}}</td>
<td>{{single_Play.play_id}}</td>
<td>{{single_Play.quest_id}}</td>
<td>{{single_Play.question}}</td>
</tr></table>
JS code:
$scope.all_Play_details = response.data.play_details;
jsfiddlelink has nothing.ng-style/ng-class, but before that includebackgroundColorproperty in each element of your array