Joe Sleiman
Joe Sleiman

Reputation: 2496

ionic3 ion-slide doesn't go to next slide when trying second time

I have ion-slides in a modal that works fine:

First I lock the slides until the user answers the question; then click on next button to unlock the swipe to go to the next slide (question) etc...

This works fine, but when I close the modal when I'm still in the first slide or any slide, and back again open the modal, the first slide appears normally but when the user clicks next the next slide doesn't appear until I resize the window or make landscape orientation or move from phone window to normal browser window.

Any one know what the problem is?

ionic cli : 4.0.2

ionic-angular: 3.9.2

angular-core: 5.0.0

Some of the code: maybe will help :

ngAfterViewInit() {
  this.assessSlides.autoHeight = true;
}

ngAfterContentInit() {
  this.assessSlides._rtl = true;
  this.correctAnswersCount = 0;
  this.assessSlides.lockSwipes(true);
}

moveToTheNextQuestion() {
  if (!this.assessSlides.isEnd()) {
    this.assessSlides.lockSwipes(false);
    this.assessSlides.slideNext();
    this.assessSlides.lockSwipes(true);
  }
}

Upvotes: 0

Views: 772

Answers (1)

Joe Sleiman
Joe Sleiman

Reputation: 2496

i find this solution :

  ngAfterViewInit() {
    setTimeout(
      ()=>{
        if(this.assessSlides){
          this.assessSlides.update();
        }
      },300
    );
  }

Upvotes: 3

Related Questions