npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-quiz

v1.0.1-beta

Published

A quiz component for Angular projects

Downloads

45

Readme

Installing

npm install ngx-quiz

Usage

Import NgxQuizModule

import {NgxQuizModule} from 'ngx-quiz';

@NgModule({
  imports: [
    NgxQuizModule
  ]
})

Usage

Use it in your template and then pass a Quiz object to the component as follows as an example

<ngx-quiz [quiz]="quiz"></ngx-quiz>

Configuration

Quiz

| Property | Type | Description | | -------------------- | ----------- | --------------------------------------------------------------------------------- | | name | string | The quiz name, if defined, will appear on the start and end screen | | level | string | The quiz level, if defined, will appear on the start and end screen | | duration | number | The quiz duration in ms, if defined, will appear on the start and end screen | | automaticAdvance | boolean | Allows you to advance the question automatically after being answered | | returnAllowed | boolean | Allows the user to return to the previous question | | repeatAllowed | boolean | Allows the user to repeat the test when finished | | emitReport | boolean | If set to true, the quiz will emit a report with the user's choices when finished | | startScreen | StartScreen | Configure the intro screen. If omitted it will not be displayed | | endScreen | EndScreen | Configure the end screen. If omitted, default values will be used | | questions | Question[] | An array with the quiz questions |

Question

| Property | Type | Description | | ---------------- | ------------ | ----------------------------------------------- | | type | QuestionType | Type of question, for now only 'single' applies | | title | string | Title of question | | description | string | Description of question (optional) | | displayImage | string | An url image to display in the question | | answers | SingleAnswer | List of possible answers |

SingleAnswer

| Property | Type | Description | | ---------------- | ------ | ------------------------------------------------------ | | displayImage | string | An url image to display in the answer | | displayText | string | Answer display text | | value | number | Value of the answer (this computes for the final score |

StartScreen & End Screen

| Property | Type | Description | Default (Only in end screen) | | ---------------- | ------ | --------------------------------- |------------------------------| | title | string | Title to show on the screen | "Congrats!" | | description | string | Description to show on the screen | "You just completed" | | displayImage | string | Url image to show on the screen | | | buttonText | string | Text to display on the button | "Restart" |

Quiz object example

const quiz: Quiz = {
    name: 'Angular',
    level: 'Beginner',
    duration: 480,
    automaticAdvance: false,
    returnAllowed: true,
    repeatAllowed: true,
    emitReport: true,
    startScreen: {
      title: '',
      description: '',
      displayImage:
        'https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/1200px-Angular_full_color_logo.svg.png',
      buttonText: 'Start'
    },
    endScreen: {
      title: '¡Congratulations!',
      description: 'You complete the quiz!',
      displayImage:
        'https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/1200px-Angular_full_color_logo.svg.png',
      buttonText: 'Restart'
    },
    questions: [
      {
        type: 'single',
        title: 'In Angular, you can pass data from the parent component to the child component by using:',
        description: 'Choose the correct answer',
        displayImage: 'https://cdn.searchenginejournal.com/wp-content/uploads/2019/04/the-seo-guide-to-angular-1520x800.png',
        answers: [
          { displayText: '@Output()', value: 100 },
          { displayText: '@Input()', value: 0 },
          { displayText: 'Output', value: 0 },
          { displayText: 'Input', value: 0 }
        ]
      },
      {
        type: 'single',
        title: 'Which directive connects the value of the controls to the data?',
        description: 'Choose the correct answer',
        displayImage: 'https://cdn.searchenginejournal.com/wp-content/uploads/2019/04/the-seo-guide-to-angular-1520x800.png',
        answers: [
          { displayText: 'ng-app', value: 0 },
          { displayText: 'ng-init', value: 0 },
          { displayText: 'ng-model', value: 100 },
          { displayText: 'ng data', value: 0 }
        ]
      },
      {
        type: 'single',
        title: 'In Angular routing, which tag is used to render matched component via active route?',
        description: 'Choose the correct answer',
        displayImage: 'https://cdn.searchenginejournal.com/wp-content/uploads/2019/04/the-seo-guide-to-angular-1520x800.png',
        answers: [
          { displayText: '<router></router>', value: 0 },
          { displayText: '<router-output></router-output>', value: 0 },
          { displayText: '<router-outlet></router-outlet>', value: 100 },
          { displayText: '<router-display></router-display>', value: 0 }
        ]
      }
    ]
  };