Friday, 7 June 2019

Force child input to have the same "states" as wrapping/ parent control

Stackblitz

How can I reflect the STATE of CustomInputComponent into the ngModel/ control of the <input id="childInput"> inside the template of CustomInputComponent.

The reason I want this is because I have complicated template driven validators that I want to set on a (for e.g.) CustomInputComponent but the states "error, touched, etc ..." should be also apply to the nested inputs inside of the CustomInputComponent.

I hope its clear what im trying to achieve here.

In the Stackblitz as you will see:

If I type "43":

  • The "parent control valid:" state is false.
  • But the "child input valid:" state remains true.


from Force child input to have the same "states" as wrapping/ parent control

No comments:

Post a Comment