I need help displaying only data where "active" is set to 0. The data is retrieved in JSON format as shown below:
{
"StatusCode": 0,
"StatusMessage": "OK",
"StatusDescription": [
{ "h_id": "1",
"active": 0,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "4324fdfd",
"client_id": null
},
{ "h_id": "2",
"active": 0,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "3435fdf",
"client_id": null
},
{ "h_id": "3",
"active": 0,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "fgdge43",
"client_id": null
},
{ "h_id": "4",
"active": 1,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "edf43",
"client_id": 1
},
{
"h_id": "5",
"active": 1,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "3456677777",
"client_id": 2
},
....
{
"h_id": "10",
"active": 1,
"date_created": "2018-08-02T15:28:52.000Z",
"serial_number": "JDLk32",
"client_id": 200
}
]
}
Currently, I have the following HTML code to display all data in a dropdown:
<div class="input-field col s12">
<select formControlName="h_id" id="h_id" materialize="material_select" [materializeSelectOptions]="hbp" >
<option value="" disabled selected>Select Hb</option>
<option *ngFor="let hb of hbp" [value]="hb.h_id">{{hb.serial_number}}</option>
</select>
</div>
Although all values are correctly displayed in the dropdown, I want to filter and show only the data where active:0
.
Could you please suggest ideas on how I can achieve this filtering to display only data with active = 0
?