Retrieving data from the backend using this function:
private fetchData(): void {
this.dataService.fetchData().pipe(
tap((response: any) => {
this.persons = response.results;
this.familyMembersTrue = this.persons.filter(x => x.is_family_member === 'false')
}),
takeUntil(this.onDestroy)
).subscribe();
}
and console.log(response)
displays JSON like below
{
"count": 38,
"next": null,
"previous": null,
"results": [
{
"id": 113,
"foreigner": false,
"outside_community": false,
"nipt": "",
"nid": "G45675570K",
"is_family_member": true
},
{
"id": 115,
"foreigner": false,
"outside_community": false,
"nipt": "",
"nid": "K30776771A",
"is_family_member": false
},
{
"id": 116,
"foreigner": false,
"outside_community": false,
"nipt": "",
"nid": "J305070577",
"is_family_member": false
}...
]
}
I am interested in data with "is_family_member": false
, so I have created
this.familyMembersTrue = this.persons.filter(x => x.is_family_member === 'false')
This section of the code shows as empty.
Any ideas on how to display data with "is_family_member": false
?