ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.94k stars 13.52k forks source link

How to change dynamicaly slides in ion-slides on Ionic 2 RC1? #8759

Closed azakusilo closed 7 years ago

azakusilo commented 7 years ago

Hello. I have slider in my application:

    <ion-slides #showSlider *ngIf="product.show_images" class="slideShowWrapper productImages" [options]="mySlideOptions">
          <ion-slide *ngFor="let image of product.show_images;">
            <img [src]="image.big_url" alt="{{image.title}}"/>
          </ion-slide>
        </ion-slides>

And in code I need to change slides and count of slides. But after change the list of slides. Slider changes, but first slide not shows, or it can be showed but points of slides is not anought. How right to change slides list, to have response from slider? My code to change is:

    this.slider.getSlider()['removeAllSlides'](); // Delete slides
    this.product.changeOffer(); //Here is where I get slides to show
    this.product.show_images = this.product.getImages(); //Change the list
azakusilo commented 7 years ago

The bug seems to be appears when option loop in true mode.

stalniy commented 7 years ago

@azakusilo you need to call reLoop method of swiper on ionDidChange. Or destroyLoop() and createLoop() if swiper version is older https://github.com/nolimits4web/Swiper/blob/master/dist/js/swiper.js#L2351

jgw96 commented 7 years ago

Hello! Thanks for opening an issue with us! As this seems like more of a support question i will urge that you ask this question on our forum or on our slack channel. Thanks for using Ionic!

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.