3

I've created custom angular material control with ControlValueAccessor implemented. When submitting form, if it's invalid, I touch all the controls to make them show validation errors. For some reason my custom control gets highlighted, but does not show error texts. Here's a test project. https://stackblitz.com/edit/angular-a2rrbx

I've actually found the solution already - implementing DoCheck and checking for touched state there and then emitting stateChanges. But I wonder if there's a better solution, not involving DoCheck, as it can turn out to be expensive. The solution is described here: How do I know when custom form control is marked as pristine in Angular?. I'd like to avoid monkey-patching too.

I also can't uderstand why this is happening - the control is highlighted, so it sees the touch state, this is very confusing.

Thanks!

Ukyo
  • 43
  • 3

0 Answers0