Link to playground - https://play.nativescript.org/?template=play-ng&id=LhwHnA
The demo uses the list of categories and questions in app/core/questions.json
to populate the quiz data on the app and application-settings
to store last quiz score and last quiz date.
List of Categories and Questions can be found in app/core/questions.json
You can use this list to add, remove, or edit the list of categories and questions following the format:
{
"title": "PROGRAMMING", "quizDate": "20 October", "lastScore": "70%", "backgroundColor": "#250046", "image": "~/images/programming.png",
"questions": [
{ "question": "Programming question 1", "options": ["one", "two", "three", "four"], "correctAnswerIndex": 0 },
{ "question": "Programming question 2", "options": ["one", "two", "three", "four"], "correctAnswerIndex": 0 },
{ "question": "Programming question 3", "options": ["one", "two", "three", "four"], "correctAnswerIndex": 0 },
{ "question": "Programming question 4", "options": ["one", "two", "three", "four"], "correctAnswerIndex": 0 },
{ "question": "Programming question 5", "options": ["one", "two", "three", "four"], "correctAnswerIndex": 0 }
]
}
-
title: category title displayed on the home page
-
quizDate: leave empty (the value will be stored in app settings after first attempt)
-
lastScore: leave empty (the value will be stored in app settings after first attempt)
-
color: color of all the text in the card
-
backgroundColor: background color of the card
-
image: an absolute path to the image to be displayed on the card (leave empty if no image)
-
questions: list of questions for the category
-
question: question to be displayed
-
options: list of options for the question
-
correctAnswerIndex: index of the correct option (0 - 3)