Skip to content

Commit

Permalink
fix: typeahead $apply already in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
koox00 committed Jan 10, 2017
1 parent f48b012 commit 18dd4ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 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('mm.foundation.typeahead', ['mm.foundation.position', 'mm.foundat
};
}])

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

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

Expand Down Expand Up @@ -273,7 +273,10 @@ angular.module('mm.foundation.typeahead', ['mm.foundation.position', 'mm.foundat
var dismissClickHandler = function (evt) {
if (element[0] !== evt.target) {
resetMatches();
scope.$digest();

if (!$rootScope.$$phase) {
scope.$digest();
}
}
};

Expand Down

0 comments on commit 18dd4ad

Please sign in to comment.