We have an <input> element in our template and when we press Enter we want to trigger the component method save($event).
Approach
Bind the save($event) method to the keydown.enter event:
<input (keydown.enter)="save($event)">
Implement the save(event):
export class SaveComponent {
save() {
console.log("You entered: ", event.target.value);
}
}