I have the following problem. I have a for loop which shows a list of users and i have a button (outside of the loop) which needs to perform an action on the current user on list. How is it possible to save the value of each key to a variable each time the user swipes left or right?
Here is my code (I have used some buttons inside the slides to show what i need to do with the buttons which are outside)
<ion-slides #mainSlider (ionSlideDidChange)="slideChanged()">
<template ngFor let-user [ngForOf]="users | async">
<template [ngIf]="user.$key !== uid">
<ion-slide>
<ion-card>
<ion-card-content>
<ion-card-title>
{{user.$key}}
</ion-card-title>
</ion-card-content>
<ion-row *ngIf="premium">
<ion-col (click)="like(user.$key)">
<button ion-button icon-left clear small>
<ion-icon name="add-circle"></ion-icon>
</button>
</ion-col>
</ion-col>
</ion-row>
</ion-card>
</ion-slide>
</template>
</template>
</ion-slides>
<ion-grid>
<ion-col width-25 class="img-center" (click)="like()">
<img src="assets/images/Premium-slide5-A.png" />
</ion-col>
</ion-grid>
I can get the current index of each slide but that won’t do. I have also tried to use NgModel to assign the value from each ion-slide to a variable but again not successfully…
Any help?