To build quiz app with ionic

Just i am building small quiz app with Ionic framework… I am new to this framework. The logic behind to my app is when i click the button on homepage, it will redirect to the next page, and here the question will display and in this page also two button(true or false). When i click the true button, it has to say “Correct Answer” if the answer is correct and the score will increase , otherwise it will say “Wrong answer” and vice versa. The other trick is if i am not get the “correct answer” three times, it will goes to the final score.
Someone has an idea, you are welcome.
Thanks

What have you tried so far? What is the main thing that you are stuck on right now?

When I click a “True” button, i displayed the result on console.log but i can’t to display on html page.

Simply create an alert with the value/text inside.

You know what I want:
Just i am building a small quiz app.
When i click “True” or “False” button, i want to display the result if the answer is “Correct” or “incorrect” on the same page. The difference after clicking the button is, the page it has not the button “True” and “False”; instead “Next” button has to appear.
Sorry “Vrai” is “True” and Faux is “False”. It is french. May be you know it.

You have many options here… I am asuming you are not using a database where the questions are coming in right ?
I guess you hardcode the questions into your app.

What you could do:
Give the question a value like TRUE if you are pressing the true button now the “button” will make the check if the value of the question is true. If that is the case a next button appears as the score increases.

This is a simple true or false method. I would recommend you reading these guides since you have to understand these methods to increase your understanding for these kind of things same as developing speed :blush:.


You can use these 2 links as a sample to understand the IF - ELSE statement more same as the things you can do with it. In this example I am checking if the "certainValue is 2"

You could do it like that in your Application… (This is just a quick example and should give you an idea!)

myMethod(){
  if(this.certainValue == 2){
    console.log('Hey I am true!');
  }else{
   console.log('I am false');
  }
}

https://www.tutorialspoint.com/typescript/typescript_if_statement.htm
https://www.tutorialspoint.com/typescript/typescript_operators.htm

(This one is with Javascript but it works in Typescript also)
https://www.w3schools.com/js/js_if_else.asp

(Offical Doc of Typescript)
https://www.typescriptlang.org/docs/home.html

(Official Doc of Ionic)

(You probably won’t need this for this project but I’d recommend learning Angular aswell!)
https://angular.io/docs/

1 Like

@cherry … Some of it i solved already and thanks a lot.
If you can, please help me that i posted before in this forum with this link

Just i am trying to solve it with visibility but i got an error