Simple polling component with two main options (yes/no) and one optional (stay).
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');
// ...
}
}
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 |
Name | Type | Emited |
---|---|---|
send | void | When submit button clicked |
The example project was generated with Angular CLI version 6.1.5.
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.
MIT