diff --git a/src/typeahead/docs/readme.md b/src/typeahead/docs/readme.md index 5ea5c36fd3..efd2dfd0fc 100644 --- a/src/typeahead/docs/readme.md +++ b/src/typeahead/docs/readme.md @@ -120,3 +120,7 @@ This directive works with promises, meaning you can retrieve matches using the ` $ - Comprehension Angular expression (see [select directive](http://docs.angularjs.org/api/ng.directive:select)). + +**Notes** + +If a custom template for the popup is used, the wrapper selector used for the match items is the `uib-typeahead-match` class. diff --git a/src/typeahead/typeahead.js b/src/typeahead/typeahead.js index 5a43f9e21b..db33f5043e 100644 --- a/src/typeahead/typeahead.js +++ b/src/typeahead/typeahead.js @@ -402,13 +402,13 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap case 38: // up arrow scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1; scope.$digest(); - target = popUpEl.find('li')[scope.activeIdx]; + target = popUpEl[0].querySelectorAll('.uib-typeahead-match')[scope.activeIdx]; target.parentNode.scrollTop = target.offsetTop; break; case 40: // down arrow scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length; scope.$digest(); - target = popUpEl.find('li')[scope.activeIdx]; + target = popUpEl[0].querySelectorAll('.uib-typeahead-match')[scope.activeIdx]; target.parentNode.scrollTop = target.offsetTop; break; default: diff --git a/template/typeahead/typeahead-popup.html b/template/typeahead/typeahead-popup.html index 71232be972..64d79d23bc 100644 --- a/template/typeahead/typeahead-popup.html +++ b/template/typeahead/typeahead-popup.html @@ -1,5 +1,5 @@