I am working on creating two lists for a roster
.
The first list will display the current members of this year
, while the second list will show if individuals have been excused for this year
.
After analyzing my code, I realized that I am using two identical for loops, one to display all true Boolean values and another for false. Is there a more efficient way (a method perhaps) to showcase people who are both excused and not excused
?
<h2>Roster {{year-1}}-{{year}}</h2>
<div *ngFor="let k of peoples">
<div *ngFor="let a of k.people; let j = index">
<div *ngIf="k.year == year && k.people[j].excused == false">
{{k.people[j].firstName}} {{k.people[j].lastName}}
</div>
</div>
</div>
<h2>Excused</h2>
<div *ngFor="let k of peoples">
<div *ngFor="let a of k.people; let j = index">
<div *ngIf="k.year == year && k.people[j].excused == true">
{{k.people[j].firstName}} {{k.people[j].lastName}}
</div>
</div>
</div>