Я хотел бы отфильтровать свойство day.children
name
на основе результатов поиска. Возникли трудности с вложенным * ngFor, потому что каждый полагается на второго. dayOverViewByGroup
исходит от API. Я пытался обернуть day.children
в функцию, подобную filterIt(day.children)
, но я получил бесконечный l oop. Спасибо.
У меня есть следующая (упрощенная) html структура
<ion-searchbar placeholder="Suchen..." (ionInput)="searchChildren($event)" padding></ion-searchbar>
<ion-grid *ngFor="let day of dayOverViewByGroup; let i = index" padding>
<ion-card *ngFor="let child of day.children; let j = index">
<h1>{{child.name}}</h1>
</ion-grid>
Пример переменных данных dayOverview из API
// dayOverview variable example data from API
[
{
"name": "Kindergarden 1",
"presence_id": 25,
"totalChildren": 3,
"totalCheckinChildren": 1,
"children": [
{
"name": "John Doe",
"daycareComment": null,
"parentComment": null,
"id": "10633",
"away": null,
"checkin": [],
"additionalDay": false,
"remarks": "",
"awayClass": "",
"reason": "",
"addtionalClass": "",
"disableToggle": false,
"disabled": false,
"checkout": "Nicht anwesend",
"class": "notcheckin"
},
{
"name": "Jane Doe",
"daycareComment": null,
"parentComment": null,
"id": "8322",
"away": null,
"checkin": [],
"additionalDay": false,
"remarks": "",
"awayClass": "",
"reason": "",
"addtionalClass": "",
"disableToggle": false,
"disabled": false,
"checkout": "Nicht anwesend",
"class": "notcheckin"
},
{
"name": "Bastian Paper",
"daycareComment": null,
"parentComment": null,
"id": "86999",
"away": null,
"checkin": [],
"additionalDay": false,
"remarks": "",
"awayClass": "",
"reason": "",
"addtionalClass": "",
"disableToggle": false,
"disabled": true,
"class": "checkin",
"checkout": "Anwesend"
}
]
},
{
"name": "Kindergarden 2",
"presence_id": 26,
"totalChildren": 1,
"totalCheckinChildren": 0,
"children": [
{
"name": "Thomas Mueller",
"daycareComment": null,
"parentComment": null,
"id": "86900",
"away": null,
"checkin": [],
"additionalDay": false,
"remarks": "",
"awayClass": "",
"reason": "",
"addtionalClass": "",
"disableToggle": false,
"disabled": false,
"checkout": "Nicht anwesend",
"class": "notcheckin"
}
]
},
{
"name": "Kindergarden 3",
"presence_id": 27,
"totalChildren": 1,
"totalCheckinChildren": 0,
"children": [
]
}
]