I've been looking around, and I can't find an answer to this. I would like to have a mat dialog box open when a customer just starts typing. No focus nor input. Just starts typing. I'm sure the answer is simple, but I just can't find it. Thanks in advance!
CodePudding user response:
A simple host listener should do the trick:
@HostListener('window:keyup', ['$event'])
keyEvent(event: KeyboardEvent) {
this.openDialog();
}
Where openDialog
is the function that triggers your MatDialog.
CodePudding user response:
You can use in your input this:
<input (change)="doSomething($event.target.value)">
Using (change) event you can do something when start typing.
Let me know it worked for you.