Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

how to restrict alphabets in input field in angular

phoneKeyDown(e){
	 
		const keyCode = e.keyCode;  
		if (( (e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) && e.keyCode !=8) {
			e.preventDefault();
		} 	  
}

// IN HTML
<ion-input [(ngModel)]="phone" id="phone" formControlName="phone"  placeholder="Enter Telephone Number" (keydown)="phoneKeyUp($event)"  ></ion-input>
Comment

PREVIOUS NEXT
Code Example
Typescript :: serverless.ps1 cannot be loaded because running scripts is disabled on this system. 
Typescript :: mixpanel for typescript 
Typescript :: typescript err type 
Typescript :: typescript function as type 
Typescript :: computed vue typescript 
Typescript :: typescript loop types 
Typescript :: comments visual studio code html 
Typescript :: Lists - Learn C# 
Typescript :: array in typescript 
Typescript :: use sample weights fit model multiclass 
Typescript :: How to check if all elements are equal C# 
Typescript :: error TS2531 
Typescript :: push in typescript 
Typescript :: typescript use object keys as index 
Typescript :: c# get all elements from list 
Typescript :: js pop object from id 
Typescript :: formgroup check if valid 
Typescript :: nodejs stream write file 
Typescript :: pytest tests in subfolder 
Typescript :: dart clone list 
Typescript :: typescript generics constraints 
Typescript :: conditional type typescript 
Typescript :: ts enum 
Typescript :: typescript delete value from map 
Typescript :: across tab localstorage 
Typescript :: asciidots helloworld 
Typescript :: pass multiple arguments to thread python 
Typescript :: welsh cup electrodes have 
Typescript :: file attachements contac form 7 
Typescript :: muliple time series plots in pandas 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =