Duplicate ion-slides with *ngFor


#1

Hi, i’m using ion-slide to show a slideshow of images. I’m using slider.getActiveIndex() to calculate the current active slide. However, because there are duplicate slides, the slider.getActiveIndex() function is giving me the wrong values.

My code looks like:

Wich wil result in the following output:

As you can see if have 2 duplicate slides, slide 1 and 6. I tried removing the imageResize pipe, but this doesn’t seem to change anything. I’m using “article.hasAlbum()” to check if there are any images.

Does anyone know how i can get rid of the duplicate slides. Or how i can reliable calculate the active slide?


#2

They are there because you can swipe back from slide 1 to slide 6 and forward from 6 to 1. To provide good performance and no flickering, hacky transformation this slides are there twice


#3

Wow, i didn’t think of that. When i set loop to false the indexes are indeed calculated correctly. Thanks alot!