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

Commit 0d96221

Browse files
committed
fix(typeahead): do not execute unnecessary $digest
- If in a $digest, do not execute `scope.$digest` Fixes #2652 Closes #3791
1 parent 115d490 commit 0d96221

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/typeahead/typeahead.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
2929
};
3030
}])
3131

32-
.directive('typeahead', ['$compile', '$parse', '$q', '$timeout', '$document', '$position', 'typeaheadParser',
33-
function ($compile, $parse, $q, $timeout, $document, $position, typeaheadParser) {
32+
.directive('typeahead', ['$compile', '$parse', '$q', '$timeout', '$document', '$rootScope', '$position', 'typeaheadParser',
33+
function ($compile, $parse, $q, $timeout, $document, $rootScope, $position, typeaheadParser) {
3434

3535
var HOT_KEYS = [9, 13, 27, 38, 40];
3636

@@ -318,7 +318,9 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
318318
var dismissClickHandler = function (evt) {
319319
if (element[0] !== evt.target) {
320320
resetMatches();
321-
scope.$digest();
321+
if (!$rootScope.$$phase) {
322+
scope.$digest();
323+
}
322324
}
323325
};
324326

0 commit comments

Comments
 (0)