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
Post a Comment