The PasswordInput component for Angular represents a widget which enables you to input passwords with nice visual feedback about the password's strength.
npm install -g @angular/cli ng new jqwidgets-project cd jqwidgets-project
ng add jqwidgets-ng
jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package
npm install jqwidgets-ng
@import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';
"styles": [ "node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css" ]
<jqxExpander [theme]="'fluent'" #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 [theme]="'fluent'" #firstName class="firstName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Last Name
</td>
</tr>
<tr>
<td>
<jqxInput [theme]="'fluent'" #lastName class="lastName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Choose your username
</td>
</tr>
<tr>
<td colspan="2">
<jqxInput [theme]="'fluent'" #userName class="userName" [width]="300" [height]="21"></jqxInput>
</td>
</tr>
<tr>
<td colspan="2">
Create a password
</td>
</tr>
<tr>
<td colspan="2">
<jqxPasswordInput [theme]="'fluent'" #password class="password" [width]="300" [height]="21"></jqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">
Confirm your password
</td>
</tr>
<tr>
<td colspan="2">
<jqxPasswordInput [theme]="'fluent'" #passwordConfirm class="passwordConfirm" [width]="300" [height]="21"></jqxPasswordInput>
</td>
</tr>
<tr>
<td colspan="2">
Birthday
</td>
</tr>
<tr>
<td colspan="2">
<jqxDateTimeInput [theme]="'fluent'" #birthday class="birthday"
[width]="300"
[height]="21">
</jqxDateTimeInput>
</td>
</tr>
<tr>
<td colspan="2">
Gender
</td>
</tr>
<tr>
<td colspan="2">
<jqxDropDownList [theme]="'fluent'" #gender class="gender"
[source]="genders"
[selectedIndex]="-1"
[placeHolder]="'I am...'"
[autoDropDownHeight]="true"
[width]="300"
[height]="21">
</jqxDropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<jqxButton (onClick)="buttonClicked()">Create account</jqxButton>
</td>
</tr>
</table>
</form>
</jqxValidator>
</div>
</jqxExpander>
import { Component, ViewChild } from '@angular/core';
import { jqxExpanderComponent, jqxExpanderModule } from 'jqwidgets-ng/jqxexpander';
import { jqxInputComponent, jqxInputModule } from 'jqwidgets-ng/jqxinput';
import { jqxValidatorComponent, jqxValidatorModule } from 'jqwidgets-ng/jqxvalidator';
import { jqxDropDownListComponent, jqxDropDownListModule } from 'jqwidgets-ng/jqxdropdownlist';
import { jqxDateTimeInputComponent, jqxDateTimeInputModule } from 'jqwidgets-ng/jqxdatetimeinput';
import { jqxButtonComponent, jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
import { jqxPasswordInputModule, jqxPasswordInputComponent } from 'jqwidgets-ng/jqxpasswordinput';
@Component({
selector: 'app-root',
imports: [jqxPasswordInputModule, jqxButtonModule, jqxExpanderModule, jqxInputModule, jqxDropDownListModule, jqxValidatorModule, jqxDateTimeInputModule],
standalone: true,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
@ViewChild('createAccount') createAccount: jqxExpanderComponent;
@ViewChild('firstName') firstName: jqxInputComponent;
@ViewChild('lastName') lastName: jqxInputComponent;
@ViewChild('userName') userName: jqxInputComponent;
@ViewChild('password') password: jqxPasswordInputComponent;
@ViewChild('passwordConfirm') passwordConfirm: jqxPasswordInputComponent;
@ViewChild('validatorReference') myValidator: jqxValidatorComponent;
@ViewChild('gender') gender: jqxDropDownListComponent;
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>');
};
}