Introduction
I always forget how can i listen input event. So I write this post.
Listening Event
With out Angular
With out Angular framework we have to use javascript to bind event like this code
<input type="text" id="myInput">
document.getElementById('myInput').addEventListener('keyup', myInput);
function myInput(input) {
console.log(input.keyCode);
}
With Angular
With Angular framework is more easier to bind event
<input type="text" (keyup.enter)="onEnter()">
onEnter(): void {
console.log("submit");
}
you can change another key like shift or anthoer you want