An AngularJS (1.x) directive to mask inputs with currency values
Para ler este documento em Português
, clique aqui
$ npm install angular-money-mask --save
or
$ bower install angular-money-mask --save
<script src="https://github.com/rwaltenberg/angular-money-mask/raw/master/rw-money-mask.min.js"></script>
rw.moneymask
moduleangular.module('yourApp', ['rw.moneymask'])
money-mask
<input type="text" name="price" ng-model="model.price" money-mask />
Obs: ngModel is required!
Number
. e.g.: 100
($ 100.00), 4.20
($ 4.20), 4340.65
($ 4,340.65)$filter('number')
, which uses $locale.NUMBER_FORMATS
configuration (separators, fraction size, etc) so it's i18n compatible.Use money-mask-append
and money-mask-prepend
to add some text to the formatted currency.
<input type="text" name="price" ng-model="model.price" money-mask money-mask-prepend="$" />
or
<input type="text" name="price" ng-model="model.price" money-mask money-mask-append="dollars" />