Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

md-chips + md-autocomplete: suggestions not shown after all items added & removed #8432

Closed
sebastianhomeier opened this issue May 12, 2016 · 3 comments
Assignees
Milestone

Comments

@sebastianhomeier
Copy link

Actual behavior:

  • What is the issue?

In my example (https://jsfiddle.net/vv18yjzo/7/) the autocomplete suggestions should be shown, as long as the md-chips input is focused. This works well when I enter a few items. However, when all available items are added and then removed, the autocomplete suggestions are empty / hidden. I have to enter a new search text to see the autocomplete suggestions again.

  • What is the expected behavior?

The md-autocomplete suggestions should be shown when no items are selected (= the chips input is empty) and the md-chips input is focused.

CodePen or Steps to reproduce the issue: *

Angular Versions: *

  • Angular Version: 1.4.8
  • Angular Material Version: 1.0.8

Additional Information:

  • Browser Type: Chrome
  • Browser Version: 50
  • OS: OS X El Capitan
  • Stack Traces:
@sebastianhomeier
Copy link
Author

sebastianhomeier commented May 12, 2016

I narrowed my problem down to the value of searchText. If an item gets removed and searchText is an empty string, you can simple set searchText equal to null. Afterwards, vm.searchCategories() in md-items="item in vm.searchCategories()"of the md-autocomplete directive gets called:

vm.onCategoryRemoved = function($chip, $index) {
    if(!vm.autocomplete.searchText) {
        vm.autocomplete.searchText = null;
    }
};

Example: https://jsfiddle.net/vv18yjzo/10/

Despite, it would be great to have a built-in solution for showing the suggestions everytime the md-chips input element is focused.

@topherfangio
Copy link
Contributor

I think this may actually be related to #7655 which I'm investigating right now. I will keep you updated if I find that it's related.

@topherfangio topherfangio self-assigned this May 24, 2016
@ThomasBurleson ThomasBurleson modified the milestone: Deprecated May 26, 2016
@ThomasBurleson
Copy link
Contributor

This issue is closed as part of our ‘Surge Focus on Material 2' efforts.
For details, see our forum posting @ http://bit.ly/1UhZyWs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants