Currently, I am in the process of creating a dashboard and could use some assistance.
After receiving a JSON from an API, I extract an array with 5 elements, each structured as follows (although simplified).
{
"app_id": "id",
"app_name": "name",
"users_percentiles": {
"users_percentile_1": "3408",
"users_percentile_2": "2356",
"users_percentile_3": "988",
"users_percentile_4": "1099",
}
}
Subsequently, I utilize a table to organize these elements within my dashboard.
<tbody ng-repeat="dash in dashboard">
<tr>
<td>{{dash.app_id}}</td>
<td>{{dash.app_name}}</td>
<td ng-repeat="percentile in dash.users_percentiles">
{{(percentile}}%
</td>
</tr>
</tbody>
I am aiming to highlight the highest percentile value for each ng-repeat loop (highlight both if two are equal).
I believe I need to incorporate something like:
ng-class="{max : percentile == maxPercentile}"
and then implement a function:
$scope.maxPercentile = -1;
angular.forEach(percentiles, function (percentile) {
if (percentile > $scope.maxPercentile) {
$scope.maxPercentile = percentile;
}
});
However, I am uncertain about when and where to integrate this method.
I attempted using a $watch but encountered difficulties in getting it to function correctly...