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

Commit

Permalink
fix(typeahead): do not execute unnecessary $digest
Browse files Browse the repository at this point in the history
- If in a $digest, do not execute `scope.$digest`

Fixes #2652
Closes #3791
  • Loading branch information
wesleycho committed Jun 11, 2015
1 parent 115d490 commit 0d96221
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/typeahead/typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
};
}])

.directive('typeahead', ['$compile', '$parse', '$q', '$timeout', '$document', '$position', 'typeaheadParser',
function ($compile, $parse, $q, $timeout, $document, $position, typeaheadParser) {
.directive('typeahead', ['$compile', '$parse', '$q', '$timeout', '$document', '$rootScope', '$position', 'typeaheadParser',
function ($compile, $parse, $q, $timeout, $document, $rootScope, $position, typeaheadParser) {

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

Expand Down Expand Up @@ -318,7 +318,9 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap
var dismissClickHandler = function (evt) {
if (element[0] !== evt.target) {
resetMatches();
scope.$digest();
if (!$rootScope.$$phase) {
scope.$digest();
}
}
};

Expand Down

0 comments on commit 0d96221

Please sign in to comment.