JSPM

@deividfortuna/input-number

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 37
  • Score
    100M100P100Q73820F
  • License MIT

Angular numeric input directive

Package Exports

  • @deividfortuna/input-number

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@deividfortuna/input-number) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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