I have one text input and one button (see below). How can I use JavaScript to trigger the button\'s click event when the Enter key is pressed ins
In Angular2:
(keyup.enter)="doSomething()"
If you don't want some visual feedback in the button, it's a good design to not reference the button but rather directly invoke the controller.
Also, the id isn't needed - another NG2 way of separating between the view and the model.