Giter VIP home page Giter VIP logo

angular2-number-picker's Introduction

angular2-number-picker

GitHub version NPM version

A generic number picker Angular component (v. 2.0.0+) for Twitter Bootstrap

Requirements

UI Dependency

Installation

npm install angular2-number-picker -save

Basic usage

Import the NumberPickerComponent in your app.module and add it to the declarations array. Alternatively, you can import the NumberPickerComponent to a shared module, to make it available across all modules in your Angular application. You need to import the Angular FormsModule and ReactiveFormsModule as well.

...
import { NumberPickerComponent } from 'angular2-number-picker/components';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent,
    NumberPickerComponent
  ],
  imports: [
    FormsModule, 
    ReactiveFormsModule
    ...
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Add the angular2-number-picker directive to the page where you want to use the number picker.

<angular2-number-picker [min]="1" [max]="6" [step]="1" [precision]="1" [inputDisabled]="true" (onChange)="onNumberChanged($event)"></angular2-number-picker>

Directive Inputs and Outputs

Attribute Type Required Description
min [input] Number No The minimal number limit on the number picker. 0 by default
max [input] Number No The maximum number limit on the number picker. 100 by default
step [input] Number No The step value for the number picker. 1 by default
precision [input] Number No The decimal precision for the number picker, if the step input value is a decimal value. 1 by default
inputDisabled [input] Boolean No Defines if the input input should be disabled / editable by the user. false by default
onChange (output) Number No The onChange event of the component. Emits the value of the number picker, every time the user has clicked the - or + button.

angular2-number-picker's People

Contributors

fuke avatar

Watchers

 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.