diff --git a/src/global/money/money.js b/src/global/money/money.js index a87d0849..2726650d 100644 --- a/src/global/money/money.js +++ b/src/global/money/money.js @@ -30,6 +30,14 @@ function MoneyMaskDirective($locale, $parse, PreFormatters) { return new StringMask(maskPattern, {reverse: true}); } + if (angular.isDefined(attrs.uiDecimalDelimiter)) { + decimalDelimiter = attrs.uiDecimalDelimiter; + } + + if (angular.isDefined(attrs.uiThousandsDelimiter)) { + thousandsDelimiter = attrs.uiThousandsDelimiter; + } + if (angular.isDefined(attrs.uiHideGroupSep)) { thousandsDelimiter = ''; } diff --git a/src/global/money/money.test.js b/src/global/money/money.test.js index 192d9cc5..458faaaf 100644 --- a/src/global/money/money.test.js +++ b/src/global/money/money.test.js @@ -208,6 +208,24 @@ describe('ui-money-mask', function() { expect(model.$viewValue).toBe('345.00'); }); + it('should employ a custom thousands delimiter', function() { + var input = TestUtil.compile('', { + model: 1234567.00 + }); + + var model = input.controller('ngModel'); + expect(model.$viewValue).toBe('$ 1|234|567.00'); + }); + + it('should employ a custom decimal delimiter', function() { + var input = TestUtil.compile('', { + model: 123.00 + }); + + var model = input.controller('ngModel'); + expect(model.$viewValue).toBe('$ 123|00'); + }); + it('should add currency after value', function() { var input = TestUtil.compile('', { model: 345.00