From b5aa642dea2d5ec2312a26aaa242d96b5af4bbcf Mon Sep 17 00:00:00 2001 From: PatrickJS Date: Tue, 29 Jul 2014 12:07:24 -0700 Subject: [PATCH] fix(input): $evalAsync than $apply on input blur without $evalAsync I would have to wrap a few directives in a setTimeout to prevent digest loop conflicts ```javascript angular.module('directives', []) .directive('focusOn', function($parse) { return function(scope, element, attrs) { // avoid $digest in progress setTimeout(function() { var getter = $parse(attrs.focusOn); if (getter(scope)) { element[0].focus(); } }, 0); }; }) ``` --- src/ng/directive/input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 0c37eaf40306..eed23d9f34ad 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -2182,7 +2182,7 @@ var ngModelDirective = function() { } element.on('blur', function(ev) { - scope.$apply(function() { + scope.$evalAsync(function() { modelCtrl.$setTouched(); }); });