In this example I want to disable the backspace key on the input field.
I am passing the $event in my template as:
<input (input)="onInput($event)">
while in my app.component.ts file the function is like this:
onInput(e:KeyboardEvent){
if(e.keycode===8){
e.preventDefault();
}else{
console.log(e.which);
}
Also Typescript is complaining about e.keycode and e.which as being deprecated.
Edit: I forgot to add double quotes in the question on : (input)="onInput()"