Skip to content

kaeldric/angular-numeric-directive

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

angular-numeric-directive

NPM

Build Status Code Climate Test Coverage NPM

This angular directive prevents the user from entering non-numeric values.

  • There are checks on min and max values. When the value falls below the minumum the value is set to the minumum value. When the value exceeds the maxiumum, the value is set to the maximum.
  • Formatting is done on the blur event; thousand separator and decimal are based on the current Angular locale.
  • The number of decimals can be set.

Usage:

  1. Include the numeric-directive as a dependency for your app.

    angular.module('myApp', ['purplefox.numeric'])
  2. Use the directive in your view:

<input numeric min="-20" max="100" decimals="3" />

Attributes

max: maximum input value. Default undefined (no max)

min: minimum input value. Default 0.

decimals: number of decimals. Default 2.

formatting: apply thousand separator formatting. Default true.

symbol: apply a symbol before or after the number. Default undefined (no symbol).

symbol-pos: sets the position of the symbol. Default 'right'.

About

AngularJS numeric directive

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.6%
  • HTML 4.4%