material icon indicating copy to clipboard operation
material copied to clipboard

md-autocomplete : items not displayed after that the clear button has been clicked

Open NicolasBlois opened this issue 11 years ago • 4 comments

To reproduce :

  1. Select an item from the list
  2. Click clear button
  3. Select "Louisiana" state (need to scroll in the list to reproduce)
  4. Clear again

out-8

NicolasBlois avatar Nov 15 '15 01:11 NicolasBlois

+1 Seems like the options re-appear when you scroll.

pmchugh3 avatar Nov 18 '15 11:11 pmchugh3

+1 happens to me too when searchText is cleared programmatically.

antoinebrault avatar Dec 22 '15 14:12 antoinebrault

If anyone is looking for a temporary fix:

$scope.$watch('vm.searchText', function (newValue, oldValue) {
    if (newValue && oldValue === '') {
        var ctrl = angular.element('md-virtual-repeat-container.md-autocomplete-suggestions-container')
            .controller('mdVirtualRepeatContainer');

        if (ctrl) {
            $timeout(function () {
                ctrl.resetScroll();
            }, vm.debounceSearchText + 125);
        }
    }
});

antoinebrault avatar Dec 22 '15 15:12 antoinebrault

Already fixed in HEAD.

ThomasBurleson avatar Apr 19 '16 19:04 ThomasBurleson