angular - Angular4 - cant implement password match validator -


from angular docs:

const form = new formgroup({   password: new formcontrol('', validators.minlength(2)),   passwordconfirm: new formcontrol('', validators.minlength(2)), }, passwordmatchvalidator);   function passwordmatchvalidator(g: formgroup) {    return g.get('password').value === g.get('passwordconfirm').value       ? null : {'mismatch': true}; } 

i don't know how call passwordmatchvalidator function. tried like:

<div *ngif="form.passwordmatchvalidator">

but without success...

to show div error message if passwords don't match, do:

<div *ngif="form.haserror('mismatch')"> 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

android - IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling -