Why is formGroup (formRef.form) empty in ngAfterViewInit?

百般思念 提交于 2021-01-29 05:43:57

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!