How to prevent ion-Slide pager to be clicked from Slide 1 to Slide 3 when Slide 2 is not answered?


#1

I am working on a questionnaire application where the user cannot go from one screen to another until the question is answered on a slide. I got everything working except pager (this dots) is allowing the user to go from one slide to another even though question# 2 is not answered. I added the following logic but its not working as expected. Its still allowing me to jump from slide 0 to slide 2. Adding this.slideTo(this.currentIndex) changed the dot to be highlighted for slide 0 however its still at Slide# 2. Please advise!

onSlideWillChange(event) {
    let answerNotSelected: boolean = false;
    for (let i: number = 0; i < this.slides.getActiveIndex(); i++) {
      answerNotSelected = this.questionnaire.questions[i].selectedAnswer === undefined;
      if (answerNotSelected) { 
        console.log('Returning from newQuestionIndex ' + this.slides.getActiveIndex() +  ' to current slide:' + this.currentQuestionIndex);
        this.slideTo(this.currentQuestionIndex);
      }
    }
 }