How can I loop through my json data to find two specific key values e.g. weight = "8m" and meters = "7t" then return the name value of the object where these two values are found e.g. "25t".
data.json (Small sample)
[
{
"name": "20t",
"weight": ["1t","2t","3t","4t","5t"],
"meters": ["7m","8m","9m","10m","12m","14m","16m","18m"]
},
{
"name": "25t",
"weight": ["1t","2t","3t","4t","5t","6t","7t","8t"],
"meters": ["7m","8m","9m","10m","12m","14m","16m","18m","20m","22m"]
}
]
I'm able to loop through all the data using ngif and ngfor.
<div *ngIf="crane?.length">
<div *ngFor="let data of crane">
<p>{{data.name}}</p>
<p>{{data.weight}}</p>
<p>{{data.meters}}</p>
</div>
</div>
But I need to output only the specific name value where the weight and meters match the key value I want. Any idea on how I could achieve this? I'm quite new to angular, any help would be appreciated.