I would like to filter the results of a JSON file, I already retrieve the list of data with keyvalue. But I would like to retrieve only the results or parent equals null.
Example of the data present in the JSON file
{ "1": { "id": 1, "name": "Example name", "parent": null, }, "2": { "id": 1, "name": "Example name", "parent": 12, } }
Here is my data retrieved from a JSON file
this.http.get(api).subscribe((data) => { this.number = Object.keys(data).length; this.cats = data; });
And here is the HTML which processes the received data
<ion-row> <ion-col *ngFor="let item of cats | keyvalue" size="6"> </ion-col> </ion-row>
https://stackoverflow.com/questions/67395052/filter-results-subscribe-with-keyvalue-in-ionic May 05, 2021 at 12:05PM
没有评论:
发表评论