As you notice, if you get typeahead
to display any results, after you blur out the input the ng-repeat
of the queries gets cleared out.
Whilst I want it to hide but stay there so as it could be instantly shown again on refocus of the input
.
How to get typeahead
not to clear the ng-repeat
list?
Exact demo of functionality I am trying to achieve
It's different from codepen I linked.
Editing the dismissClickHandler
in the following way works around the problem.
var dismissClickHandler = function (evt) {
if (element[0] !== evt.target) {
resetMatches();
scope.$digest();
} else if (element.val().length) {
element.focus();
hasFocus = true;
getMatchesAsync(element.val());
}
};