I built a custom directive for input elements. It is a search directive that given an items input returns an output with these items filtered based on the search string.
<input pieSearch placeholder='Search' [attribute]='"label"' [formControl]='search'
[items]='widgetOfSelectedType' (filterEvent)='filterWidgets($event)'>
Under the hood, I am simply using a Hostlistener and then calling a pipe. As such:
@HostListener('keyup', ['$event.target.value']) onKeyUp(value) {
this.searchTerm = value;
this.applyFilter();
}
That works well for everything expect when I want to reset my input this.search.reset(). Which makes sense, as this isn't a user typing in the input field it isn't caught by the Hostlistener.
So my question to you all, is how would you go about doing that?