<ion-grid> <ion-row *ngFor="let item of gallerydata;let i = index"> <ion-col width-50> <ion-card> <img [src]="item[i].thumbpath"/></ion-card> </ion-col> <ion-col width-50> <ion-card> <img [src]="item[i+1].thumbpath"/></ion-card></ion-col> </ion-row> </ion-grid>
this is sample code same code works with ionic1 but not working with ionic2
Please suggest
mvrc
November 15, 2016, 10:34am
2
Is it a sanitizing problem (you should have warning during execution time if so) ?
Any error ? Does it compile ? Do you just have a white screen during execution ?
White screen during execution
if i remove [i] and [i+1] this work fine . but the result which it will render is not my requirement
http://market.ionic.io/plugins/ionic-gallery . my requirement should be like this
mvrc
November 15, 2016, 11:00am
5
You want to prompt images 2 by 2 ?
Isn’t it gallerydata[i] instead of item[i] ?
The [i+1] is weird, because at the last line it won’t work.
Thanks a lot .this works . i am trying to solve that last line by including ngif
Unable to solve that with Ngif .Do you have any solution for this?
mvrc
November 15, 2016, 1:29pm
8
Yes, i personnaly have a page with this :
<figure *ngFor="let c of categories.list;" (click)="categories.toggle(c)">
<img class="font" *ngIf="c.active" src="assets/categories/active/{{c.picto}}" >
<img class="font" *ngIf="!c.active" src="assets/categories/inactive/{{c.picto}}" >
<figcaption [style.backgroundColor]="categories.cat[c].color">{{"CATEGORIES." + c | translate}}</figcaption>
</figure>
with something like that :
figure {
position: relative;
display: inline-block;
margin: 2px;
width: calc(50% - 8px);
}
All my picture are in shape of square, but you can take what you want from this code.
The idea is to display items one by one and not 2 by 2.