ive got a ionic grid with 3 foreach loop's inside eachother the most outer loop would look like this:
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col>
<ion-row>
<ion-col *ngFor="let field1 of gs.fields; let x = index; trackBy: trackByFn">
<!-- More Foreach Loops inside each other-->
</ion-col>
</ion-row>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
but i want to get a new row every time x%3 == 0[and if i keep the first outside of the loop i need x%3 == 0 && x != 0]
i would love to keep everything inside the loop the same and not copy code
Screens at the Bottom
my first thought was to do something like:
<ion-content padding>
<ion-grid>
<ion-row>
<ion-col>
<ion-row>
<ion-col *ngFor="let field1 of gs.fields; let x = index; trackBy: trackByFn">
<ion-row *ngIf="x%3==0 && x!=0">
<!-- More Foreach Loops inside each other-->
</ion-row *ngIf="x%3==0 && x!=0">
</ion-col>
</ion-row>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
x is running in a range from 0 to 8, so </ion-row *ngIf="x%3==0 && x!=0"> as closing tag should be fine because i close the ion-row outside the outter foreach loop. But this isnt loading.
How it is:
How i want it to be:

<ion-content padding>
<ion-grid>
<ion-row>
<ion-col *ngFor="let field1 of gs.fields; let x = index; trackBy: trackByFn">
<div *ngIf="gs.won_fields[x] == false" [ngClass]="{'bordern':x%2==0,'bordernplus1':x%2!=0}">
<ion-col *ngFor="let field2 of field1; let y = index; trackBy: trackByFn">
<ion-row>
<ion-col class="ctr fc tile" *ngFor="let tile of field2; let z = index; trackBy: trackByFn" (click)="playerClick(x,y,z)">
<span class="ctr" [ngClass]="{'player1': tile==1, 'player2' : tile==2}">{{(tile==0)? ' ': ((tile==1)? 'x' : 'o')}}</span>
</ion-col>
</ion-row>
</ion-col>
</div>
<!-- Wenn Feld gewonnen x oder o eintragen -->
<span class="ctr tile" *ngIf="gs.won_fields[x] != false" [ngClass]="{'bordern':x%2==0,'bordernplus1':x%2!=0}" [ngClass]="{'player1': gs.won_fields[x]===1, 'player2' : gs.won_fields[x]===2}">{{(gs.won_fields[x]==1)? 'x' : 'o'}}</span>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>