I just started learning Angularjs, and I'm not sure how to achieve this.
I want to highlight the member with the highest Score, Missed, and Field Goal percentage by adding color. Is there a way to do this? https://i.sstatic.net/9KF5D.png
Is it possible to change the color of the value to green for the member with the largest value in each column?
https://i.sstatic.net/ggBhm.png like this: (desired result)
This is my HTML code:
<body ng-app="myApp" ng-controller="myCtrl">
<table border="2">
<tr>
<th>Members</th>
<th>Score</th>
<th>Missed</th>
<th>FG%</th>
</tr>
<tr ng-repeat="member in members">
<td>{{member.name}}</td>
<td>{{getScore(member.shotMade)}}</td>
<td>{{getMissed(member.shotMade, member.shotAttemp)}}</td>
<td>{{getFG(member.shotMade, member.shotAttemp)}}</td>
</tr>
</table>
This is my javascript code:
const app = angular.module('myApp', []);
app.controller('myCtrl', function($scope){
$scope.test = "success";
$scope.members =
[
{name:'Kobe', shotMade:23, shotAttemp:44},
{name:'lebron', shotMade:21, shotAttemp:33},
{name:'Jordan', shotMade:32, shotAttemp:43},
{name:'Hakeem', shotMade:20, shotAttemp:21},
]
$scope.getScore = (made)=> made * 2;
$scope.getMissed = (made, attemp) => attemp - made;
$scope.getFG = (made, attemp) => (made / attemp) * 10000;
});
Is there a way to achieve this using AngularJS or JavaScript?