From 97e077e115b91490f759d0eda873ddf1ab7778c9 Mon Sep 17 00:00:00 2001 From: Maarten Winkels Date: Wed, 17 Dec 2014 17:37:59 +0100 Subject: [PATCH] fix(typeahead): only reset matches if matches are present - Resets matches only when matches are present to avoid extra $digest Closes #3119 --- src/typeahead/typeahead.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index ad6843d4f8..5d744971d7 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -404,7 +404,7 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap var dismissClickHandler = function (evt) { // Issue #3973 // Firefox treats right click as a click on document - if (element[0] !== evt.target && evt.which !== 3) { + if (element[0] !== evt.target && evt.which !== 3 && scope.matches.length !== 0) { resetMatches(); if (!$rootScope.$$phase) { scope.$digest();