Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Allow click-event only if a boolean is true

$
0
0

Hello,
I have a little quiz, where a user needs to tab a button to select an answer. So each button has a click event calling the method “checkAnswer” where the boolean break is set to true. At the same time, the ion-content has a click event calling the method “nextQuestion”.
This method looks like that:

nextQuestion() {
    if(!this.break) {
      return;
    }
   ....
  }

Now If I don’t click a button, this works. but If I click a button, I go to the next question immediatly. But I want the click on the answer and the next click then gets me to the next question. It seems like the button-event is executed before the ion-content-event, which means break is set to true before nextQuestion can return.

How would I fix this?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles