1.3.0 • Published 1 year ago
ngx-textmask v1.3.0
Angular Input Mask
Getting started
First, install it.
npm i ngx-textmask --saveThen, import it into your @NgModule:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { TextMaskModule } from 'ngx-textmask';
@NgModule({
imports: [
FormsModule,
TextMaskModule
],
declarations: []
})
export class MyModule {}Then, use it in your component:
@Component({
selector: 'app',
template: `
<input [textMask]="{mask: mask}" [(ngModel)]="myModel" type="text"/>
`
})
export class AppComponent {
public myModel = ''
public mask = ['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]
}