Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 99a1be4

Browse files
author
AngularUI (via TravisCI)
committed
Travis commit : build 402
1 parent 6d03cc2 commit 99a1be4

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

ui-utils.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ angular.module('ui.mask', [])
459459
'9': /\d/,
460460
'A': /[a-zA-Z]/,
461461
'*': /[a-zA-Z0-9]/
462-
}
462+
},
463+
'clearOnBlur': true
463464
})
464465
.directive('uiMask', ['uiMaskConfig', '$parse', function (maskConfig, $parse) {
465466
'use strict';
@@ -546,7 +547,7 @@ angular.module('ui.mask', [])
546547
linkOptions = (function(original, current){
547548
for(var i in original) {
548549
if (Object.prototype.hasOwnProperty.call(original, i)) {
549-
if (!current[i]) {
550+
if (current[i] === undefined) {
550551
current[i] = angular.copy(original[i]);
551552
} else {
552553
angular.extend(current[i], original[i]);
@@ -741,11 +742,15 @@ angular.module('ui.mask', [])
741742
}
742743

743744
function blurHandler(){
744-
oldCaretPosition = 0;
745-
oldSelectionLength = 0;
745+
if (linkOptions.clearOnBlur) {
746+
oldCaretPosition = 0;
747+
oldSelectionLength = 0;
748+
}
746749
if (!isValid || value.length === 0) {
747-
valueMasked = '';
748-
iElement.val('');
750+
if (linkOptions.clearOnBlur) {
751+
valueMasked = '';
752+
iElement.val('');
753+
}
749754
scope.$apply(function (){
750755
controller.$setViewValue('');
751756
});

0 commit comments

Comments
 (0)