I am using angular 8 and need to default click a button on a page when Enter
key is pressed. The thing is the button is not inside any form. There are other buttons beside it. Clicking them works fine, but I need to press this one on Enter
key press. I read some suggestions but none seems fitting in. I tried `(keyup.Enter)="search()" but it didn't work.
<button
id="log-button"
(click)="search()"
color="primary"
[disabled]="logForm.invalid"
class="link-button"
>Search</button
>
P.S. - Though there is logForm
here but it's only for validation purpose and there isn't any <form>
tags in the html where this button is placed.
Any help us much appreciated.