Initial slide when within modal


#1

Hi,

I have a few slides within a modal. When activating the modal a param is passed which is the number slide the slider should initially start on. Using <ion-slides [options]="{initialSlide: 3}"> sees the first slide displayed and then changes to the initial slide index (3) after a delay of about 1 sec. The delay appears to be the point the swiper initEvents are attached.

As a hack, I tried hiding all slides but the slide I want to be the initial slide which works as expected (the initial slide index opening in the modal), but of course this is with all other slides hidden making the remaining slides unavailable. The current slide also changes when unhiding the other slides.

This functionality use to work fine in Ionic 1.

Any advice?

Thanks.


#2

The way I fixed it was adding an image on top of the slides and then hiding it when the modal has opened.

Check out my repo https://github.com/nikini/ionic-gallery-modal


#3

Hi Nikini,

That work around works thanks!

The problem now is my slides contain more content than a single image, meaning I’ll need to inject the content into the page somehow first.

Nice clean package by the way!