-
Notifications
You must be signed in to change notification settings - Fork 6.8k
mat-error can not be displayed when i compare password and confirmPassword #14118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The https://material.angular.io/components/input/overview#changing-when-error-messages-are-shown |
Hello, exemple works without mat-error on stackoverflow Can you tell me how to do it with mat-error, please? |
Please keep GitHub issues for bug reports / feature requests. Better avenues for troubleshooting / questions are stack overflow, gitter, mailing list, etc. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
I tried to compare the value of two fields in the form, but it doesn't work with mat-error.
When i set a password, i want to display two error messages under the two input component or display at least the error message under the empty component.
Here is one of the input component, another one is coded with the same code.
HTML:
*****
<mat-error *ngIf="form.errors.mismatch">
mismatch error
TYPESCRIPT:
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};
}
What is the expected behavior?
I want to display the error after the input
What is the current behavior?
No error displayed
What are the steps to reproduce?
Providing a StackBlitz reproduction is the best way to share your issue.
StackBlitz starter: https://goo.gl/wwnhMV
What is the use-case or motivation for changing an existing behavior?
I want to compare the password, and display the error message after each input component
It works when i use the <div *ngIf="hasError()"> to dislpay the error message, but not with mat-error.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular V5.0.3
Material: V5.0.0-rc.1
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: