1.0.2 • Published 3 years ago

ngx-numbers-only-directive v1.0.2

Weekly downloads
-
License
Mozilla Public Li...
Repository
github
Last release
3 years ago

NumbersOnlyDirectiveLibrary

This project adds a new directive called NgxNumbersOnly it assures an HTML Input element will only recieve numbers.

it can be defined to allow negative numbers or disallow them as well as decimal point numbers.

This project was generated with Angular CLI version 11.2.6.

How To Install

Run npm i ngx-numbers-only-directive .

How To Use

In your appModule Import NgxNumbersOnlyDirectiveModule: import { NgxNumbersOnlyDirectiveModule }

and add it to your imports array: imports: [NgxNumbersOnlyDirectiveModule]

Add the directive to an input element. example:<input NgxNumbersOnly>

To allow Negative numbers:<input NgxNumbersOnly [allowSign]=true>

To allow decimals:<input NgxNumbersOnly [allowDecimals]=true [allowSign]=true>

Contribute

If you enjoyed this code consider donating using paypal:Donations

Thanks

The base for this directive was a StackOverflow answer by Elvis Fernandez.