Skip to content

Small package for input number to be sure for correct number and supporting Japanese keyboard process.

License

Notifications You must be signed in to change notification settings

De-Amir/ng-digits

Repository files navigation

NgDigits

This package make sure avoiding non-digits character for input. NgDigits also support maximum digits and Japanese input.

Browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Opera
Opera
IE11, Edge last 3 versions last 3 versions last 3 versions last 2 versions last 2 versions

Install

npm install ng-digits --save

Usage

Import NgDigits Module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {NgDigitsModule} from 'ng-digits';
import { AppComponent } from './app.component';

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

Integer Number without , (eg. 12356)

<input appDigits type="text" name="text" id="text"/>

Integer Number with , (eg. 12,356)

<input [appDigits]="[]" type="text" name="text" id="text"/>

Decimal Number (eg. 1,235.62)

<input [appDigits]="['1.2']" type="text" name="text" id="text"/>

Integer Number with maximum digits (eg. 12.356)

<input [appDigits]="['1.3']" maxDigits="5" type="text" name="text" id="text"/>

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Amir Movahedi
  • See also the list of contributors who participated in this project.

How To Support

  • Fork || Star

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credit

Originally made for @DefideInc by @De-Amir.

About

Small package for input number to be sure for correct number and supporting Japanese keyboard process.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published