Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { PasswordValidators } from 'ngx-validators';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-reactive-password-validator',
templateUrl: './password-validator.component.html',
styleUrls: ['./password-validator.component.css']
})
export class ReactiveFormPasswordValidatorComponent implements OnInit {
form: FormGroup;
value: string;
password = new FormControl('', Validators.compose([
//Validators.required,
PasswordValidators.repeatCharacterRegexRule(4),
PasswordValidators.alphabeticalCharacterRule(1),
PasswordValidators.digitCharacterRule(1),
PasswordValidators.lowercaseCharacterRule(1),
PasswordValidators.uppercaseCharacterRule(1),
PasswordValidators.specialCharacterRule(1)
]));
confirmPassword = new FormControl('');
constructor(protected _fb: FormBuilder) { }
ngOnInit() {
this.form = this._fb.group({
'newPassword': this.password,
'confirmPassword': this.confirmPassword
});