borosr / ngx-poll

Polling component in Angular 6 with Bootstrap 4 (ngx-bootstrap)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngx-poll

Simple polling component with two main options (yes/no) and one optional (stay).

npm version

Table of contents

  1. Installation instructions

  2. Documentation

    @Inputs

    @Outputs

  3. Example

    Development server

  4. License

Installation instructions

Install ngx-poll from npm:

npm install ngx-poll --save

Add PollModule to NgModule imports:

import { PollModule } from 'ngx-poll';

@NgModule({
  // ...
  imports: [
      PollModule,
      // ...
  ]
  // ...
})

Add component to your page:

<ngx-poll [questions]="questions"></ngx-poll>

You will need ngx-bootstrap configuration:

  • Into your index.html
<!--- index.html -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
  • Into your app.component.ts
import { setTheme } from 'ngx-bootstrap/utils';

@Component({...})
export class AppComponent {
  constructor() {
    setTheme('bs4');
    // ...
  }
}

Documentation

@Inputs

Name Type Default value
primaryButtonTitle string 'Yes'
primaryButtonValue any true
secondaryButtonTitle string 'No'
secondaryButtonValue any false
submitButtonTitle string 'Send'
submitButtonEnabled boolean false
dataLoaded boolean true
questions [{ text: string, value: any }] undefined

@Outputs

Name Type Emited
send void When submit button clicked

Example

The example project was generated with Angular CLI version 6.1.5.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

License

MIT

About

Polling component in Angular 6 with Bootstrap 4 (ngx-bootstrap)

License:MIT License


Languages

Language:TypeScript 69.7%Language:HTML 15.5%Language:JavaScript 14.1%Language:CSS 0.7%