1 validateNumber(event) {
2 const keyCode = event.keyCode;
3
4 const excludedKeys = [8, 37, 39, 46];
5
6 if (!((keyCode >= 48 && keyCode <= 57) ||
7 (keyCode >= 96 && keyCode <= 105) ||
8 (excludedKeys.includes(keyCode)))) {
9 event.preventDefault();
10 }
11 }
12
1<input type="password" placeholder="Enter Mobile no" formControlName="mobile_no" (keydown)="validateNumber($event)">
2