[英]Call a function when clicking on the “X” of md-autocomplete (Angular Material)
How can I call a function (defined by me) when clicking on the cross (X) that clears the text of Angular Material's autocomplete? 当单击清除Angular Material自动完成文本的十字(X)时,如何调用函数(由我定义)?
[Link to md-autocomplete] ( https://material.angularjs.org/latest/demo/autocomplete ) [链接到md-autocomplete]( https://material.angularjs.org/latest/demo/autocomplete )
There is no direct click event for the clearance button of md-autocomplete
but you can detect when the text gets cleared using the md-search-text-change
event: md-autocomplete
的清除按钮没有直接点击事件,但您可以使用md-search-text-change
事件检测文本何时被清除:
function searchTextChange(text) {
if (!text) {
console.log("text got cleared")
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.