I am looking to create a grid-style view for a list of Angular components, where I can display up to 4 components in each row.
The question that comes close to what I need is the following: Angular 2 NgIf, dont render container element on condition but show its child elements
However, this solution only works when the container has one child. Here is my initial attempt (I understand that an else case could be used):
<ng-container *ngFor="let pair of responsePair; let i = index">
<ng-container *ngIf="i % 4 == 0">
<div class="row">
<app-report-tile></app-report-tile>
</div>
</ng-container>
<ng-container *ngIf="i % 4 != 0">
<app-report-tile></app-report-tile>
</ng-container>
</ng-container>
Currently, the row container is only printed for every 4th element, whereas I need the next 3 child components to also belong to this row container.
Is there a way to conditionally not render an HTML element?