AngularJS Money Directive To Format Currency Inputs

Author: fiestah
Official Page: Go to website
Publish Date: November 20, 2014
License: MIT

Description:

An AngularJS directive that formats and validates monetary inputs in “xx.xx” format (some additional work is needed for “xx,xx” European formats). Note that this is not designed to work with currency symbols. It largely behaves like Angular’s implementation of type="number".

Features:

  • Prevents entering non-numeric characters
  • Prevents entering the minus sign when min >= 0
  • Supports min and max like in <input type="number">
  • Rounds the model value by precision, e.g. 42.219 will be rounded to 42.22 by default
  • On blur, the input field is auto-formatted. Say if you enter 42, it will be formatted to 42.00

Preview:

AngularJS Money Directive To Format Currency Inputs

Angular Money Directive Demo


You Might Be Interested In:

Add Comment