Skip to content

laijuthomas/ngx-textmask

Repository files navigation

Angular Input Mask

Getting started

First, install using below command. Note: The below method is for standalone components

npm i ngx-textmask --save

Then, use it in your component:

import { NgModule } from '@angular/core';
import { MaskedInputDirective } from 'ngx-textmask';

@Component({
  selector: 'app',
  imports: [
    MaskedInputDirective
  ],
  template: `
    <input [textMask]="{mask: mask}"  type="text"/>
  `
})
export class AppComponent {
  public myModel = ''
  public mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
}

About

Masking library to mask phone, date, currency etc

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •