Guest User

Untitled

a guest
Jun 6th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <mat-form-field hintLabel="Minimum 8 Characters" class="">
  2. <mat-label>Password</mat-label>
  3. <input
  4. matInput
  5. #input
  6. type="password"
  7. formControlName="password">
  8. <mat-hint align="end">{{input.value?.length || 0}}/8</mat-hint>
  9. </mat-form-field>
  10.  
  11. <mat-form-field>
  12. <mat-label>Confirm</mat-label>
  13. <input
  14. matInput
  15. required
  16. type="password"
  17. #confirm
  18. formControlName="confirmPassword">
  19. <mat-error *ngIf="form.get('confirmPassword').invalid || confirmPasswordMismatch">Password does not match</mat-error>
  20. </mat-form-field>
  21.  
  22. public get confirmPasswordMismatch() {
  23. return (this.form.get('password').dirty || this.form.get('confirmPassword').dirty) && this.form.hasError('confirmedDoesNotMatch');
  24. }
  25.  
  26. this.form = new FormGroup({
  27. userName: new FormControl(null, [Validators.required]),
  28. fullName: new FormControl(null, [Validators.required]),
  29. email: new FormControl(null, [Validators.required, Validators.pattern(this.EMAIL_REGEX)]),
  30. password: new FormControl(null),
  31. confirmPassword: new FormControl(null, ),
  32. }, (form: FormGroup) => passwordValidator.validate(form));
Add Comment
Please, Sign In to add comment