Naughty Pinching Mannequins
Miss any of our Open RFC calls?Watch the recordings here! »

This package has been deprecated

Author message:

ngx-material-faq has been renamed to @angular-material-extensions/faq. Please update your dependencies

ngx-material-faq

2.0.1 • Public • Published

ngx-material-faq - Angular Library built with material design in order to provide a reusable faq (frequently asked questions) component for every project. Ask, Answer and List

npm version, npm Coverage Status Coverage Status dependency Status devDependency Status Greenkeeper Badge license

This project has been moved to @angular-material-extensions/faq

ngx-material-faq

Demo

View all the directives in action at https://anthonynahas.github.io/ngx-material-faq

Dependencies

  • Angular v6.x (requires Angular 2 or higher, tested with 2.0.0) - Angular V6 - Material V6 are now supported

Requirements (peer dependencies):

npm i @angular/cdk @angular/material @angular/flex-layout @angular/animations @angular/forms 

Additional requirements (Material Design)

Installation

Install above dependencies via npm.

Now install ngx-material-faq via:

npm install -s ngx-material-faq

SystemJS

Note:If you are using SystemJS, you should adjust your configuration to point to the UMD bundle. In your systemjs config file, map needs to tell the System loader where to look for ngx-material-faq:

map: {
  'ngx-material-faq': 'node_modules/ngx-material-faq/bundles/ngx-material-faq.umd.js',
}

Once installed you need to import the main module:

import { NgxMaterialFaqModule } from 'ngx-material-faq';

The only remaining part is to list the imported module in your application module. The exact method will be slightly different for the root (top-level) module for which you should end up with the code similar to (notice NgxMaterialFaqModule .forRoot()):

import { NgxMaterialFaqModule } from 'ngx-material-faq';
 
@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgxMaterialFaqModule.forRoot(), ...],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

Other modules in your application can simply import NgxMaterialFaqModule:

import { NgxMaterialFaqModule } from 'ngx-material-faq';
 
@NgModule({
  declarations: [OtherComponent, ...],
  imports: [NgxMaterialFaqModule, ...], 
})
export class OtherModule {
}

Usage

add the ngx-material-faq or the ngx-material-faq-admin element to your template:

ngx-material-faq

This component aims to list the provided frequently asked questions

ngx-material-faq

<ngx-material-faq [faqList]="list"></ngx-material-faq>
import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {FaqItem} from 'ngx-material-faq';
 
export class HomeComponent implements OnInit {
  
    ngOnInit() {
    }
 
  list: FaqItem[] = [
    {
          question: 'Why does it think the jQuery plugin is missing?',
          answer: 'Remember: load jQuery before AngularJS if you are using jQuery plugins!'
        },
        {
          question: 'How do I access the DOM from a controller?',
          answer: 'DO NOT perform DOM selection/traversal from the controller. The HTML hasn\'t rendered yet. Look up \'directives\'.'
        }
  ];
  
 }
 

ngx-material-faq-admin

This component is actually for admin purposes, like to add a frequently asked question to the backend, firebase ... and so on..

ngx-material-faq-admin

<ngx-material-faq-admin [title]="'Admin'" (onFAQItemAdded)="onNewFaqItem($event)"></ngx-material-faq-admin>

in your component

import {Component, OnInit, ViewEncapsulation} from '@angular/core';
import {FaqItem} from 'ngx-material-faq';
 
export class HomeComponent implements OnInit {
  
   ngOnInit() {
      }
 
  faq: FaqItem[] = [];
  
  onNewFaqItem(faqItem: FaqItem) {
      console.log('on new faqItem -> ', faqItem);
      this.faq.splice(0, 0, faqItem);
    }
  
 } 

Please checkout the full documentation here or follow the official tutorial

Development

  1. clone this repo
  2. Install the dependencies by running npm i
  3. build the library npm run build or gulp build To generate all *.js, *.d.ts and *.metadata.json files:
$ npm run build
  1. Link the library
  • on windows gulp link or locally npx gulp link
  • on mac/linux sudo gulp link or locally sudo npx gulp link
  1. Navigate to the demo app's directory
  • cd demo _ npm i _ npm start

extras To lint all *.ts files:

$ npm run lint

Other Angular Libraries

License

Copyright (c) 2018 anthonynahas. Licensed under the MIT License (MIT)

Install

npm i ngx-material-faq

DownloadsWeekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

61.4 kB

Total Files

19

Last publish

Collaborators

  • avatar