I have a list of elements that I would like to display in a 3 col * x rows grid. I'm not sure how to do this in Angular 2 or Ionic 2. Looking through https://angular.io/docs/ts/latest/guide/template-syntax.html# for a while, here is what I did :
<ion-grid>
<ion-row *ngIf="i%3 == 0" #i>
<ion-col width-33 *ngFor="let item of items; let i=index" >
<ion-card>
<img src="{{item.image}}" />
<ion-card-content>
<ion-card-title>
{{item.title}}
</ion-card-title>
<p></p>
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
which does not work. As a job, I can break the list of elements into pieces before they are passed to the template, but I believe that it is a little more elegant, let the template handle it - if possible.
What are the correct directives and syntaxes?
Shawn source
share