Skip to content
Non Standard Angular HTML5 Number input with thousand separators
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
dist
samples
src
test chore: add tests for the directive
.bowerrc
.gitignore
.jshintrc Initial commit
README.md
bower.json
demo.gif
gulpfile.js
package.json

README.md

Angular Formatted Number Input

Simple angular directive to format numbers in input elements. When displaying the numbers are formatted using standard thousand-separators like: 123,456. When editing, numbers are free of any formatting.

Since HTML5 input[type=number] does not allow comma characters, we recommend that you use it with type=tel or type=text.

HTML5 Validation support

Supports all standard HTML5 input[type=number] validations such as:

  • Number (according to this floating point spec
  • Mininum (use the min or data-min attribute)
  • Maximum (use the max or data-max attribute)

Extra attributes

In addition to HTML5 number validation, there is one extra attribute:

  • Precision data-precision=[number]: set the precision of the floating point value. Defaults to 0.

Demo

in flight

Usage

angular.module('myApp', ['hongy']);
<input type="tel" data-number>

Contribute

  1. Fork
  2. Clone
  3. Write tests
  4. Make sure it conforms to coding style present in the source code
  5. Make sure all tests pass and cover all aspects of your code
  6. Send a pull request
Something went wrong with that request. Please try again.