I'm using Angular Material input fields and there is a problem that fields become red as soon as user does something to it.
However, I need these fields to stay "valid" until the form is submitted, so that the user starts seeing errors only after clicking submit button.
In casual inputs I've used that thing <input [class.ng-invalid]="control.invalid && submitted"> thus it starts turning red after clicking "Submit".
However that didn't help me when I tried to apply this to matInput
<mat-form-field class="w-100">
<input [id]="id" matInput
[class.ng-invalid]="control.errors && submitted"
[placeholder]="getPlaceholder()"
[formControl]="control">
</mat-form-field>
How do I achieve displaying errors only after submitting?