Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/global/money/money.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
}
Expand Down
18 changes: 18 additions & 0 deletions src/global/money/money.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<input ng-model="model" ui-money-mask ui-thousands-delimiter="|">', {
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('<input ng-model="model" ui-money-mask ui-decimal-delimiter="|">', {
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('<input ng-model="model" currency-symbol="EUR" ui-currency-after ui-money-mask="mdecimals">', {
model: 345.00
Expand Down