I come to you for talking about a problem with angular material. In fact, I think it\'s an issue, but I prefer looking for a misunterstanding first.
The first thing abou
How to create a custom validation:
if the internal property 'isValid' of the component is false, then set the input status in error, and display a message.
HTML:
Input not valid.
TS:
isValid = true; changeValitationStatus() { this.matcher = new InputErrorStateMatcher(!this.isValid); } matcher = new InputErrorStateMatcher(!this.isValid); class InputErrorStateMatcher implements ErrorStateMatcher { constructor(private errorstate: boolean) {} isErrorState(control: FormControl|null, form: FormGroupDirective|NgForm|null):boolean { return this.errorstate; } }
And in this way you have a validation using only the formControl.