I'm dynamically injecting a component (using @ViewChild and insert()) with form controls into a component that wraps it with a form tag (so that I can have many different form templates with the same form handling).
This all works fine, but now when I check form.valid, it's always valid because apparently, it doesn't see the form controls that are dynamically injected.
Can I somehow trigger a 'reinitialization' of the ngForm directive on the form so that it will know that there are additional form controls injected?
Note: I do realise by now that a better solution to this problem would probably be to use model driven forms, but right now it's too short notice to redo the whole thing.
Parent template:
<form #htmlFormElement="ngForm" novalidate>
<div #dynamicComponentContainer></div>
<!-- more buttons and shared form controls here -->
</form>
Child template E.g.:
<textarea name="comments" [(ngModel)]="formData.comments"></textarea>