Reputation: 449
I am trying to use ngIf within an ngFor but it's just breaking my code. Below is my code:
<ion-row *ngIf="{{i % 3}}===0" *ngFor="let category of categories; let i=index">
I need to check if the index mod 3 is equal to zero
Upvotes: 0
Views: 110
Reputation: 214017
You can overwrite your code like:
<ion-row *ngFor="let category of categories; let i=index">
<ng-container *ngIf="{{i % 3}}===0">
...
</ng-container>
</ion-row>
ng-container
behaves the same as template
but you can use common syntax like *ngIf
and *ngFor
Upvotes: 3
Reputation: 1217
i
before initializing it in ngFor will never workUpvotes: 0