Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-eha.only-digits

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-eha.only-digits

Angular directive to only allow digits in an input field

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

angular-eha.only-digits

Build Status

Provides a Angular directive for input fields to ensure that only digits are accepted. Optionally converts the input to an integer.

Installation

Install with npm:

npm install --save angular-eha.only-digits

Or alternatively, with Bower:

bower install --save angular-eha.only-digits

Usage

Add eha.only-digits to your app's module dependencies:

angular.module('app', [
  'eha.only-digits'
]);

Use like this:

<input type="text" only-digits>
<input type="text" only-digits convert-to-number="true">

The input field has to be of type text, otherwise the browser will send undefined as value when there is invalid input and we cannot hook into ngModel.$parsers to remove unwanted chars.

Optionally convert-to-number="true" can be set to convert the the string input value to a number before its set on the model.

License

Apache 2.0, see LICENSE

Author

© 2015 Till Reitemeyer & Robin Mehner for eHealth Systems Africa

Keywords

FAQs

Package last updated on 10 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc