1

For now I am using @Input() to pass error messages from parent to child component that implements ControlValueAccessor. I would like to know is there better way of passing error messages. Please guide me. Thank you

<mat-form-field class="increment"> <input matInput [formControl]="_control.control" type="text" [disabled]="disabled" [max]="max" [min]="min" [errorMessage]="errorMessage" [(ngModel)]="value"/> </mat-form-field> 

Let me know if you know how it can be done

1 Answer 1

0

Try using setError() provided by the ControlValueAccessor interface. Refer this link to understand the concept behind this: https://indepth.dev/posts/1143/a-thorough-exploration-of-angular-forms

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.