Monday, October 29, 2018

how to do Masking of text field in AngularJS for phone number

Step 1:- Install ngx-mast using below site
https://www.npmjs.com/package/ngx-mask
Step 2:- Run follwing npm command to install
npm install --save ngx-mask
Step 3:- Import the same in your app.modules.ts
import {NgxMaskModule} from 'ngx-mask'
@NgModule({
(...)
imports: [
NgxMaskModule.forRoot()
]
(...)
})
Step4: Finnaly add the text in your application html file
<input type='text' prefix="+7 " mask="(000) 000 00 00" >
or
<input type='text' prefix="(7 " mask="00) 000 00 00" >

Image1

No comments: