In my Angular project, I can populate the 4 employeeList components using the following loop:
<div *ngFor="let record of records">
<p-panel >
<div comp-employeeList [listFilter]="record.Filter"></div>
</p-panel>
</div>
However, when I try to add 2 other components (statistic) as the 2nd and 4th element, I cannot use this loop. Actually I want to populate my components as shown on the image below. 1st and 3rd components for employee, 2nd and 4th is statistics components. So, how can I populate these 4 elements using ngFor? I know there is nth element in css, but I have no idea if it is suitable. Also there is index feature in *ngFor, but cannot use it properly in these components. It is ok just populate 1st and 3rd elements using *ngFor. Any help would be appreciated.
<div *ngFor="let record of records">
<p-panel >
<div comp-employeeList [listFilter]="record.Filter"></div>
</p-panel>
</div>
<div>
<p-panel>
<div comp-statistics></div>
</p-panel>
</div>
Should I use ngSwitch in ngFor statement?
Update
I also tried this:
<div *ngFor="let record of records; let o=odd; let e=even;">
<div *ngIf="o">
1st component
</div>
<div *ngIf="o">
2nd component
</div>
<div *ngIf="e">
3rd component
</div>
<div *ngIf="e">
4th component
</div>
</div>