[Fixed] Check is even ngFor angular 4

Issue

I have the bellow code to display two images in a single row.but the checking *ngIf="even" was not working .What is wrong with this?

 <div *ngFor="let narative_image of narative_images;let i = index;">
       <ion-row *ngIf="even" >
           <ion-col>
             <img  style="width: 100%; height: auto;"   src="{{narative_image[i].thumbimg}}" />
           </ion-col>
           <ion-col>
              <img  style="width: 100%; height: auto"  src="{{narative_image[i+1].thumbimg}}" />
           </ion-col>
       </ion-row>
   </div>

Solution

Define ‘even’

<div *ngFor="let n of narative_images;let i = index; let even = even">

More info here.

Leave a Reply

(*) Required, Your email will not be published