Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(input): use apply on change event only when one isn't already in …
Browse files Browse the repository at this point in the history
…progress

Closes #5293
  • Loading branch information
IgorMinar committed Dec 31, 2013
1 parent d158dd1 commit a80049f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/ng/directive/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
});
}

var listener = function(ev) {
var listener = function() {
if (composing) return;
var value = element.val();

Expand All @@ -419,11 +419,7 @@ function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
}

if (ctrl.$viewValue !== value) {
// If an event was performed natively, jQuery sets the isTrigger property.
// When triggering event manually, the field is not present. Manually
// triggered events are performed synchronously which causes the "$digest
// already in progress" error.
if (ev && ev.isTrigger) {
if (scope.$$phase) {

This comment has been minimized.

Copy link
@mgol

mgol Jan 2, 2014

Member

@IgorMinar IMO at least a part of the above comment was useful, i.e. the part saying that manually triggered jQuery events are synchronous.

ctrl.$setViewValue(value);
} else {
scope.$apply(function() {
Expand Down

0 comments on commit a80049f

Please sign in to comment.