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!
Asked
Active
Viewed 635 times
-2
-
this [question](https://stackoverflow.com/q/19911378/3462319) or [this one](https://stackoverflow.com/a/24622017/3462319)? – depperm Mar 16 '22 at 14:24
-
Not angularjs, angular 7 – Kevin Wilde Mar 16 '22 at 14:26
-
I mean similar googling https://stackoverflow.com/q/37362488/3462319, SE isn't really a coding service. At least make an attempt before asking [mcve] – depperm Mar 16 '22 at 14:30
2 Answers
2
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.

bamoure
- 51
- 1
1
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.

Jose Vicente
- 169
- 8