I have the JSON like below but I have a lot of data:
items: [ { itemId: "22222", category: 'A', total: 100, price: 20 }, { itemId: "666666", category: 'A', total: 80, price:10 }, { itemId: "555", category: 'B', total: 50 , price:10 } .... ... { itemId: "555", category: 'B', total: 2, price: 2 } ]
I create on .scss
&.is-green {
color: green;
}
&.is-red {
color: red;
}
I want to use it something like that:
<div *ngFor="let item of items;>
<div>{{item.category}}</div>
<div
[ngClass]="{
'is-green': item.total ,
'is-red':item.total
}"
>
{{item.total}}</div>
</div>
From this data I want to find min value of total and price and change color to green. Also I want to find max value of total and price and change color to red.
I want to color only min and max value, if value are same I not coloring
Please, have you any idea how to make this?