diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index dd603575..98973ae5 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -522,7 +522,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { // a row. var revalidate = validity && ctrl.$$hasNativeValidators; if (ctrl.$viewValue !== value || (value === '' && revalidate)) { - if (scope.$$phase) { + if (scope.$root.$$phase) { ctrl.$setViewValue(value); } else { scope.$apply(function() { diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index e5dd5e7e..9af76c9e 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -580,19 +580,30 @@ describe('input', function() { }); if (!_jqLiteMode) { - it('should not cause the double $digest when triggering an event using jQuery', function() { - $sniffer.hasEvent = function(eventName) { - return eventName !== 'input'; - }; + describe('double $digest when triggering an event using jQuery', function() { + function run() { + $sniffer.hasEvent = function(eventName) { + return eventName !== 'input'; + }; - compileInput(''); + compileInput(''); - scope.field = 'fake field'; - scope.$watch('field', function() { - // We need to use _originalTrigger since trigger is modified by Angular Scenario. - inputElm._originalTrigger('change'); + scope.field = 'fake field'; + scope.$watch('field', function() { + // We need to use _originalTrigger since trigger is modified by Angular Scenario. + inputElm._originalTrigger('change'); + }); + scope.$apply(); + } + + it('should not cause the double $digest with non isolate scopes', function() { + run(); + }); + + it('should not cause the double $digest with isolate scopes', function() { + scope = scope.$new(true); + run(); }); - scope.$apply(); }); } });