- הוסף לסימניות
- #1
היי
אני משתמשת ב mat-stepper של אנגולר מטריאל.
יש לי step אחד של הכנסת סיסמא
ואחריו step של אימות סיסמא.
הוספתי ב ts ולידציה לאימות סיסמא באופן הבא:
(ב- ngOnInit)
וזה לא נותן להתקדם לstep הבא גם אם הסיסמא תואמת.
מצרפת קטעי קוד רלוונטים- תודה!!
html:
אני משתמשת ב mat-stepper של אנגולר מטריאל.
יש לי step אחד של הכנסת סיסמא
ואחריו step של אימות סיסמא.
הוספתי ב ts ולידציה לאימות סיסמא באופן הבא:
this.fourFormGroup = new FormGroup({'fourCtrl': new FormControl('', [Validators.required, Validators.pattern('[0-9]{6,10}'), this.passwordValidators.bind(this)])
});(ב- ngOnInit)
וזה לא נותן להתקדם לstep הבא גם אם הסיסמא תואמת.
מצרפת קטעי קוד רלוונטים- תודה!!
passwordValidators(password : FormControl): { [errorPassword: string]: boolean } {
if (password.value != this.password1){
// console.log("לא תואם")
return { errorPassword: true }
}
// console.log("תואם")
return { errorPassword: false };
}html:
<mat-step [stepControl]="thirdFormGroup" errorMessage="ערך סיסמא חסר/ לא תקין">
<form [formGroup]="thirdFormGroup">
<ng-template matStepLabel>סיסמא</ng-template>
<mat-form-field appearance="fill">
<mat-label>הכנס סיסמא</mat-label>
<input matInput [type]="hide ? 'password' : 'text'" formControlName="thirdCtrl">
<button mat-icon-button matSuffix (click)="hide = !hide" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="hide">
<mat-icon>{{hide ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
</mat-form-field>
<div>
<button mat-button matStepperPrevious>הקודם</button>
<button mat-button matStepperNext (click) = "clickPassword1()">הבא</button>
</div>
</form>
</mat-step>
הנושאים החמים