Codepen here:
http://codepen.io/jros/pen/MwqZje?editors=101
Is a fork of md-autocomplete floatting label example, I have added a button to clear the selectedItem property and the control no refresh it.
To test, select an item from md-autocomplete and click clear button.
Tested on Chrome and v0.10.1-rc3
You are clearing the selected item just fine. Maybe what you are trying to do is also clear the text from the autocomplete box? To do that you should add the following to your clear method.
self.searchText = undefined;
So it looks like this:
self.clear = function(){
self.searchText = undefined;
self.selectedItem = undefined;
};
yes, it makes sense ...
Clearing searchText is enough.
self.clear = function(){
self.searchText = undefined;
};
If that is correct behavior the issue can close, is it?
The whole reset handling is still a bit buggy in my opinion.
See https://github.com/angular/material/issues/3084#issuecomment-123221872
Yes, I have had to change minlength from 0 to 1 in my html to work fine.
I'm closing this issue and grow up #3084
And if we don't want to chage minlength from 0 to 1, what can we do ?
document.activeElement.blur();
Most helpful comment
Yes, I have had to change minlength from 0 to 1 in my html to work fine.