问题
I realise that my formRef.form.controls returns an empty array in ngAfterViewInit. I use template-driven form and there are 4 elements in the form. They are available after some time. But I need them to be in formRef.form.controls.
So, can I subscribe to some event which signals that the form is ready? Or use some other approach?
Here is the small StackBlitz example: https://stackblitz.com/edit/angular-ngafterviewinit-quirks
来源:https://stackoverflow.com/questions/55728910/why-is-formgroup-formref-form-empty-in-ngafterviewinit