I have a custom control using ControlValueAccessor, and my control is in a form with a bunch of material input controls.
The material inputs show the red validation underline in 3 cases.
- the control has been touched and is invalid
- the control is dirty and invalid
- the form containing the control has been submitted and the control is invalid
I want to mimic this behavior in my custom control. I've used the injector to get a reference to the NgControl which lets me determine if the control is touched/dirty and invalid. But I can't figure out how to access the parent NgForm in a generic way to determine if it is submitted.
I don't want to explicitly pass it into my component, and I shouldn't need to since it isn't being explicitly passed to material input either yet that control is able to determine if the form has been submitted.
How do I get a hold of the parent forms submitted state?