Hi,
on the master, I'm unable to reset the selected input from md-autocomplete by setting the model to _null_
Here is the demo : http://codepen.io/jgx/pen/XbMmxE
Well, you need to set the md-search-text variable to null as well. See the modified demo: http://codepen.io/anon/pen/oXZmVG
@CxRes this works but if you have set md-min-length="0" it will open the popup again.
Anyways I think the desired behavior should be the same way as with md-select by just setting the selected item to null.
This is as designed and would require you to set both the searchText and the selectedItem. I believe resetting just searchText would also clear selectedItem.
@robertmesserle

it would be more in line with md-select as you also just set the ng-model to null (and in the context of autocomplete selectedItem is the model in my opinion)
btw setting searchText to null actually results in an exception, setting it to '' works as far as I can tell in a codepen with the current master (but I had problems with a master from last week, so I will recheck this tomorrow at my actual project)
@stefan-schweiger The problem is that we have two models that we need to track for Autocomplete. An empty searchText always means that there is no selectedItem, but the opposite is not always true. (ie. while typing in your query, searchText has a value, but you haven't yet selected an item.)
@robertmesserle ok I see. Also now I remember what the problem was, when you have set md-min-length="0" the popup comes back open when you set md-search-text to '' and as it has no focus it behaves kind of weird.
http://codepen.io/anon/pen/waEzgv
What's even worse in my case is that I hide the md-autocomplete after selection to display the item, when you clear it again you have the popup in the upper left corner nowhere near the md-autocomplete.

The same here, I understand that autocomplete can have no model value but searchText has it.
Just need that popup dont back open.
As a workaround, you can disable the md-autocomplete before resetting and enable it again afterwards, which is stupid as hell, but at least it works...
It looks like if we go by triggering the dom element it works.
plunker here
Actually this should be fixed within v1.1.0 with commit https://github.com/angular/material/commit/dadbcf21ff95764ddcc678a0821e1fa02beaf12d.
Hi..having a problem with md-autocomplete.
1) when item is searched and selected. After the selection, it is not closing the dropdown.
2) when you clear the text after written something in input field, there is a empty dropdown.
I'm having the same issue as @asirigada - when an item is selected, the completion suggest does not close. Any ideas, folks?
add ng-hide class in your css..
ng-hide{
display: none;
}
Hope that works. It worked for me
Edit: this worked -
.ng-hide {
display: none;
}
I wonder whether the issue has to do with the fact that I'm working on a chrome extension.
Thanks, @asirigada
I m also working on extensions... After adding the class it works..!!
This appears to be a broader issue with angular-material and chrome extensions. Ng-show doesn't work at all in chrome extensions in my experience. Adding the .ng-hide class to your CSS appears to fix that issue as well.
Yes angular-material and chrome extensions has lots of issues to solve. No working with md-virtual-repeat too. when tabs are shown, md-virtual is hidden in the dialog content.
Most helpful comment
Yes angular-material and chrome extensions has lots of issues to solve. No working with md-virtual-repeat too. when tabs are shown, md-virtual is hidden in the dialog content.