How to create custom password validator?

Hi Guys,

I’m dealing with forms and validators in Ionic but I don’t have any idea on creating a custom validators. Like in my case, I’m planning to make a custom validator to check whether if password and confirm password fields having the same values.
.
Code snippet for registration form.

Note: password_again is confirm password field.

Anyone know how to make a password validator? Thanks

Hello,

Add code not image

hello here is the code

this.register_form = form_builder.group({
      student_number : ['', Validators.required],
      clinic_level : ['', Validators.required],
      first_name : ['', Validators.compose([Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*'), Validators.required])],
      middle_name : ['', Validators.compose([Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*'), Validators.required])],
      last_name : ['', Validators.compose([Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*'), Validators.required])],
      password : [''],
      password_again : [''], 
    });
  }

Hello,

check out this answer, he did password and confirm password validation