简体   繁体   English

Check is even ngFor angular 4

[英]Check is even ngFor angular 4

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?我有波纹管代码在一行中显示两个图像。但是检查*ngIf="even"不起作用。这有什么问题?

 <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>

Define 'even'定义“偶数”

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

More info here .更多信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM