diff --git a/src/global/money/money.js b/src/global/money/money.js
index 8979346e..2b1f51f8 100644
--- a/src/global/money/money.js
+++ b/src/global/money/money.js
@@ -73,7 +73,7 @@ function MoneyMaskDirective($locale, $parse, PreFormatters) {
function parser(value) {
if (ctrl.$isEmpty(value)) {
- return value;
+ return null;
}
var actualNumber = value.replace(/[^\d]+/g,''), formatedValue;
diff --git a/src/global/money/money.test.js b/src/global/money/money.test.js
index 7ad38095..eadc5cf1 100644
--- a/src/global/money/money.test.js
+++ b/src/global/money/money.test.js
@@ -159,7 +159,6 @@ describe('ui-money-mask', function() {
var model = input.controller('ngModel');
var tests = [
- {modelValue: '', viewValue: ''},
{modelValue: '0', viewValue: '$ 0.00'},
{modelValue: '0.0', viewValue: '$ 0.00'},
{modelValue: 0, viewValue: '$ 0.00'},
@@ -173,6 +172,22 @@ describe('ui-money-mask', function() {
expect(model.$viewValue).toBe(test.viewValue);
});
+ it('should return null if $isEmpty value', function() {
+ var input = TestUtil.compile('', {});
+ var model = input.controller('ngModel');
+ var tests = [
+ {modelValue: '', viewValue: ''},
+ {modelValue: null, viewValue: null},
+ {modelValue: NaN, viewValue: NaN}
+ ];
+
+ tests.forEach(function(test) {
+ $rootScope.model = test.modelValue;
+ $rootScope.$digest();
+ expect(model.$viewValue).toBe(null);
+ });
+ });
+
it('should ignore non digits', function() {
var input = TestUtil.compile('', {});
var model = input.controller('ngModel');