I am currently working on creating a customized password component in Angular5. I am having difficulty obtaining the minimum and maximum attribute values required to validate the password.
I attempted to retrieve the values using JavaScript's getAttribute method, but unfortunately, it did not work as expected.
<password
[id]="passwordFieldId"
title="Password field"
placeholder="Enter a password"
[isValid]="isPasswordFieldValid"
[isDisabled]="isPasswordFieldDisabled"
[isRequired]="true"
type="password"
[minlength]= '5'
[maxlength] = '10'
[formControlName]="passwordFieldId"
[errorText]="errorText">
</password>
public ngOnInit() {
this.form = new FormGroup({
[this.passwordFieldId]: new FormControl('', [Validators.required, Validators.minLength(/** unsure of input here */), Validators.maxLength(/** unsure of input here */)])
});
}
public maxLength = this.form.get(this.passwordFieldId).get('maxlength');
this returns undefined