From 9a94aca4c77d41306f82c1b06bf85eaee9dc93cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20da=20Maia=20Jr?= Date: Tue, 19 Jul 2016 18:17:42 -0300 Subject: [PATCH] blurHandler Added condition to check $$phase on $rootScope. --- src/mask.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mask.js b/src/mask.js index 052eabc..1f0a494 100644 --- a/src/mask.js +++ b/src/mask.js @@ -444,12 +444,14 @@ angular.module('ui.mask', []) if (!isValid || value.length === 0) { valueMasked = ''; iElement.val(''); - scope.$apply(function() { - //only $setViewValue when not $pristine to avoid changing $pristine state. - if (!controller.$pristine) { - controller.$setViewValue(''); - } - }); + if (!scope.$$phase) { + scope.$apply(function() { + //only $setViewValue when not $pristine to avoid changing $pristine state. + if (!controller.$pristine) { + controller.$setViewValue(''); + } + }); + } } } //Check for different value and trigger change.