Angular UI Components Documentation
The Angular PasswordInput enables users to input passwords. This guide adds the Angular PasswordInput (jqxPasswordInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxpasswordinput 
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 jqxPasswordInputModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxPasswordInputModule } from 'jqwidgets-ng/jqxpasswordinput';
@Component({
selector: 'app-root',
imports: [jqxPasswordInputModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<jqxExpander #createAccount
[showArrow]="false"
[toggleMode]="'none'"
[width]="350">
<div>
Create a new account
</div>
<div style="font-family: Verdana; font-size: 13px;">
<jqxValidator #validatorReference (onValidationSuccess)="validationSuccess($event)" [rules]="rules" [hintType]="'label'">
<form id="form" style="overflow: hidden; margin: 10px;" action="./">
<table>
<tr>
<td colspan="2">
First Name
</td>
</tr>
<tr>
<td>
<jqxInput #firstName class="firstName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Last Name
</td>
</tr>
<tr>
<td>
<jqxInput #lastName class="lastName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Choose your username
</td>
</tr>
<tr>
<td colspan="2">
<jqxInput #userName class="userName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Create a password
</td>
</tr>
<tr>
<td colspan="2">
<jqxPasswordInput #password class="password" [width]="300" [height]="21"></jqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">
Confirm your password
</td>
</tr>
<tr>
<td colspan="2">
<jqxPasswordInput #passwordConfirm class="passwordConfirm" [width]="300" [height]="21"></jqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">
Birthday
</td>
</tr>
<tr>
<td colspan="2">
<jqxDateTimeInput #birthday class="birthday"
[width]="300"
[height]="21">
</jqxDateTimeInput>
</td>
</tr>
<tr>
<td colspan="2">
Gender
</td>
</tr>
<tr>
<td colspan="2">
<jqxDropDownList #gender class="gender"
[source]="genders"
[selectedIndex]="-1"
[placeHolder]="'I am...'"
[autoDropDownHeight]="true"
[width]="300"
[height]="21">
</jqxDropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<jqxButton [width]="150" (onClick)="buttonClicked()">Create account</jqxButton>
</td>
</tr>
</table>
</form>
</jqxValidator>
</div>
</jqxExpander>import { Component, viewChild } from '@angular/core';
import { jqxPasswordInputComponent } from 'jqwidgets-ng/jqxpasswordinput';
import { jqxExpanderComponent } from 'jqwidgets-ng/jqxexpander';
import { jqxInputComponent } from 'jqwidgets-ng/jqxinput';
import { jqxValidatorComponent } from 'jqwidgets-ng/jqxvalidator';
import { jqxDropDownListComponent } from 'jqwidgets-ng/jqxdropdownlist';
import { jqxDateTimeInputComponent } from 'jqwidgets-ng/jqxdatetimeinput';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { jqxPasswordInputModule } from 'jqwidgets-ng/jqxpasswordinput';
import { jqxExpanderModule } from 'jqwidgets-ng/jqxexpander';
import { jqxInputModule } from 'jqwidgets-ng/jqxinput';
import { jqxValidatorModule } from 'jqwidgets-ng/jqxvalidator';
import { jqxDropDownListModule } from 'jqwidgets-ng/jqxdropdownlist';
import { jqxDateTimeInputModule } from 'jqwidgets-ng/jqxdatetimeinput';
import { jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
@Component({
imports: [
CommonModule,
FormsModule,
jqxPasswordInputModule,
jqxExpanderModule,
jqxInputModule,
jqxValidatorModule,
jqxDropDownListModule,
jqxDateTimeInputModule,
jqxButtonModule
],
selector: 'app-root',
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App {
readonly createAccount = viewChild.required<jqxExpanderComponent>('createAccount');
readonly firstName = viewChild.required<jqxInputComponent>('firstName');
readonly lastName = viewChild.required<jqxInputComponent>('lastName');
readonly userName = viewChild.required<jqxInputComponent>('userName');
readonly password = viewChild.required<jqxPasswordInputComponent>('password');
readonly passwordConfirm = viewChild.required<jqxPasswordInputComponent>('passwordConfirm');
readonly myValidator = viewChild.required<jqxValidatorComponent>('validatorReference');
readonly gender = viewChild.required<jqxDropDownListComponent>('gender');
genders: string[] = ['male', 'female'];
rules: any[] = [
{
input: '.firstName',
message: 'First name is required!',
action: 'keyup, blur',
rule: (input: any, commit: any): boolean => {
return this.firstName().val() != '' && this.firstName().val() != 'First';
}
},
{
input: '.lastName',
message: 'Last name is required!',
action: 'keyup, blur',
rule: (input: any, commit: any): boolean => {
return this.lastName().val() != '' && this.lastName().val() != 'Last';
}
},
{
input: '.userName',
message: 'Username is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.password',
message: 'Password is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.passwordConfirm',
message: 'Password is required!',
action: 'keyup, blur',
rule: 'required'
},
{
input: '.passwordConfirm',
message: 'Passwords should match!',
action: 'keyup, blur',
rule: (input: any, commit: any): boolean => {
let firstPassword = this.password().val();
let secondPassword = this.passwordConfirm().val();
return firstPassword == secondPassword;
}
},
{
input: '.gender',
message: 'Gender is required!',
action: 'blur',
rule: (input: any, commit: any): boolean => {
let index = this.gender().getSelectedIndex();
return index != -1;
}
}
];
buttonClicked(): void {
this.myValidator().validate(document.getElementById('form'));
}
validationSuccess(event: any): void {
this.createAccount().setContent('<span style="margin: 10px;">Account created.</span>');
}
}td {
height: 40px;
}
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 in the input is changed.
<jqxPasswordInput (onChange)="onChange($event)"></jqxPasswordInput>
onChange(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, val: Gets or sets the password.
<jqxPasswordInput #myPasswordInput></jqxPasswordInput>
import { Component, viewChild } from '@angular/core';
import { jqxPasswordInputModule, jqxPasswordInputComponent } from 'jqwidgets-ng/jqxpasswordinput';
@Component({
selector: 'app-root',
imports: [jqxPasswordInputModule],
templateUrl: './app.html'
})
export class App {
readonly myPasswordInput = viewChild.required<jqxPasswordInputComponent>('myPasswordInput');
run(): void {
const value = this.myPasswordInput().val();
console.log(value);
}
}