2.0.0 • Published 3 years ago

@deividfortuna/input-number v2.0.0

Weekly downloads
245
License
MIT
Repository
github
Last release
3 years ago

InputNumber

An Angular directive only allows 0-9 and the feature of decimal numbers in the input box when typing, pasting or drag/dropping. This directive handles both Windows keyboard and Mac keyboard.

Installation

npm i @deividfortuna/input-number

Accept only integers numbers

  <input type="text"
        inputNumber>

Accept decimal numbers

<input type="text"
       inputNumber
       [acceptDecimalPlaces]="true"
       [decimalPlaces]="3">

API Reference

Import directive module

import { InputNumberModule } from '@deividfortuna/input-number';

Add the directive module to your angular module

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    InputNumberModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Properties

acceptDecimalPlaces: boolean (default: false): Wheter the input will accept decimal or not

decimalPlaces: integer (default: 2): Number of decimal places allowed when acceptDecimalPlaces is set to true

2.0.0

3 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago