Angular UI Components Documentation
The Angular MaskedInput uses a mask to distinguish between proper and improper user input. This guide adds the Angular MaskedInput (jqxMaskedInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxmaskedinput 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxMaskedInputModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxMaskedInputModule } from 'jqwidgets-ng/jqxmaskedinput';
@Component({
selector: 'app-root',
imports: [jqxMaskedInputModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana;">
<div style='margin-top: 10px;'>
Numeric
</div>
<jqxMaskedInput #numericInput
[width]="250"
[height]="25">
</jqxMaskedInput>
<div style='margin-top: 10px;'>
Zip Code
</div>
<jqxMaskedInput #zipCodeInput
[mask]="'#####-####'"
[width]="250"
[height]="25">
</jqxMaskedInput>
<div style='margin-top: 10px;'>
SSN
</div>
<jqxMaskedInput #ssnInput
[mask]="'###-##-####'"
[width]="250"
[height]="25">
</jqxMaskedInput>
<div style='margin-top: 10px;'>
Phone Number
</div>
<jqxMaskedInput #phoneInput
[mask]="'(###)###-####'"
[width]="250"
[height]="25">
</jqxMaskedInput>
<div style='margin-top: 10px;'>
IP Address (ex: 255.255.255.255)
</div>
<jqxMaskedInput #regexInput
[mask]="'[0-2][0-5][0-5].[0-2][0-5][0-5].[0-2][0-5][0-5].[0-2][0-5][0-5]'"
[width]="250"
[height]="25">
</jqxMaskedInput>
<div style='margin-top: 10px;'>
Disabled
</div>
<jqxMaskedInput #disabledInput
[disabled]="true"
[width]="250"
[height]="25">
</jqxMaskedInput>
</div>
<br />
<jqxButton #clearButton (onClick)="clear()">Clear Values</jqxButton>
import { Component, viewChild } from '@angular/core';
import { jqxMaskedInputComponent } from 'jqwidgets-ng/jqxmaskedinput';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { jqxMaskedInputModule } from 'jqwidgets-ng/jqxmaskedinput';
import { jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
@Component({
imports: [CommonModule, FormsModule, jqxMaskedInputModule, jqxButtonModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
readonly myNumericInput = viewChild.required<jqxMaskedInputComponent>('numericInput');
readonly myZipCodeInput = viewChild.required<jqxMaskedInputComponent>('zipCodeInput');
readonly mySsnInput = viewChild.required<jqxMaskedInputComponent>('ssnInput');
readonly myPhoneInput = viewChild.required<jqxMaskedInputComponent>('phoneInput');
readonly myRegexInput = viewChild.required<jqxMaskedInputComponent>('regexInput');
readonly myDisabledInput = viewChild.required<jqxMaskedInputComponent>('disabledInput');
clear(): void {
this.myNumericInput().clear();
this.myZipCodeInput().clear();
this.mySsnInput().clear();
this.myPhoneInput().clear();
this.myRegexInput().clear();
this.myDisabledInput().clear();
}
}
Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, change: This event is triggered when the value is changed and the control's focus is lost.
<jqxMaskedInput (onChange)="onChange($event)"></jqxMaskedInput>
onChange(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, val: Sets or gets the value.
<jqxMaskedInput #myMaskedInput></jqxMaskedInput>
import { Component, viewChild } from '@angular/core';
import { jqxMaskedInputModule, jqxMaskedInputComponent } from 'jqwidgets-ng/jqxmaskedinput';
@Component({
selector: 'app-root',
imports: [jqxMaskedInputModule],
templateUrl: './app.html'
})
export class App {
readonly myMaskedInput = viewChild.required<jqxMaskedInputComponent>('myMaskedInput');
run(): void {
const value = this.myMaskedInput().val();
console.log(value);
}
}