Coder Social home page Coder Social logo

quizapp's Introduction

The sole purpose of this app is to allow users to create quick quizzes comprising of multiple-choice objective questions without getting bothered about HTML aspect. The current version supports objective questions with just one answer. In future versions, there will be support for multiple correct answers out of given options.

It uses the AngularJS extensively to achieve the above objective. Following are key directives that are used to create the quiz:

  • iquiz
  • iquestion
  • iscorecard

Following represents the details on above directives:

Directive: iquiz

Directive iquiz is used to present summary information about the quiz. It consists of "iquiz" as element tag name and "summary" as attribute. The code looks like following:

<iquiz summary=""></iquiz>

Directive: iquestion

Directive iquestion is used to list down question and answer options along with correct option. It consists of "iquestion" as element tag name and "text" as attribute. The code looks like following:

<iquestion text=""></iquestion>

The question and answer options along with correct answer would be assigned to "text" attribute with following convention:

  • Question and answer options are seperated by identifier, "::"
  • Multiple answer options are seperated by identifier, ";"
  • Correct answer needs to be preceded by identifier, "__"

Take a look at an example below. Following is how the question would be displayed on the web page:

In which year, did the first world war start?
1912
1913
1914
1915

With iquestion directive, the above could be written in the following manner, and AngularJS does the rest. Pay the attention of usage of identifiers such as "::" (question and answers seperator), ";" (answer options), "__" (for right answer)

<iquestion text="In which year, did the first world war start?::1912;1913;__1914;1915"></iquestion>

Directive: iscorecard

Directive iscorecard is used to display the scores and correct answers. It just consists of "iscorecard" as element tag name. The code looks like following:

<iscorecard></iscorecard>

Installation Instructions

  • Download the zip file, unzip it.
  • Following are different files that could be found within the root/src folder:
    • quizapp-v0.2.js: This file consists of actual AngularJS code including directives
    • ui-bootstrap-tpls-0.9.0.min.js: This is included as dependency of QuizApp to style the templates using Bootstrap library.
    • templates/quiz.html: This file is a template to display iquiz directive.
    • templates/question.html: This file is a template to display iquestion directive.
    • templates/scorecard.html: This file is a template to display scorecard.
  • Copy all of the files from "src" folder to another folder, say, "quizapp" within your project and get started.
  • Include following angularjs script files. You may want to load the files from Google Hosted Libraries.
    • angular.min.js
    • angular-sanitize.min.js
  • Include bootstrap CSS library. This would make sure that the templates display neat looking HTML blocks. You may change classes in the template files to display the template differently. You may want to use Bootstrap CDN link in your page.
  • Include following CSS and script files within your HTML section. Script files can as well be added within BODY section for performance reasons.
    • <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    • <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
    • <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular-sanitize.min.js"></script>
    • <script src="quizapp/quizapp-v0.2.js"></script>. The assumption is that you have copied the downloaded file within quizapp folder as instructed above.
    • <script src="quizapp/ui-bootstrap-tpls-0.9.0.min.js"></script>. The assumption is that you have copied the downloaded file within quizapp folder as instructed above.
  • In the page, you want to use the module, define the angular app with QuizApp as dependency. The code would look like following: angular.module( "HelloApp", ["QuizApp"] );
  • Once done with above, you are all set to use following three directives:
    • iquiz
    • iquestion
    • iscorecard

QuickStart

  • The samplequiz.html presents sample code in line with instructions written above. It needs a webserver to run.
  • Copy the samplequiz.html and src folder content on a location, say, quizdemo, on your webserver.
  • Access samplequiz.html in a browser.

quizapp's People

Contributors

eajitesh avatar

Watchers

m4r71n avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.