I have a material design autocomplete working correctly. Now I need to be able to clear the selected element when a button is clicked. I see that the element's delete button that appears on the right has an $mdAutocomplete.clear() call which is exactly what I need but I don't know how to launch that.
How can I capture the element and call the clear() method? Thanks
Try to set the model which is binded to the search text with empty string:
self.clear = function() {
self.searchText = '';
}
See this codepen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With