Код: Выделить всё
Choose Student
{{ student.name }}
Choose Month
{{month}}
< /code>
Вот событие: < /p>
onStudentChange(event: any): void {
this.selectedStudentId = event.target.value;
// Get the available months with published meals for selected student
this.studentsByUser$.subscribe((students) => {
const selectedStudent = students.find((student) => student._id === this.selectedStudentId);
this.mealService.getMealsBySchool(selectedStudent?.school?._id!).subscribe((meals) => {
const months: string[] = [];
meals.map(meal => meal.date).map((dateString) => {
months.push(new Date(dateString).getFullYear() + '-' + new Date(dateString).getMonth());
})
this.months = months
});
});
}
< /code>
this.monthsПодробнее здесь: https://stackoverflow.com/questions/795 ... -happening
Мобильная версия