In a parent component using a modal, ngTemplate and a child component called createComponent):
@ViewChild(CreateComponent, { static: false }) createComponent: CreateComponent | undefined; ... ngAfterViewInit(): void { console.log(this.createComponent?.unit); // createComponent is always UNDEFINED }
It is the same issue without solutions than this alert since 5 years:
In a parent component using a modal, ngTemplate and a child component called createComponent):
@ViewChild(CreateComponent, { static: false }) createComponent: CreateComponent | undefined; ... ngAfterViewInit(): void { console.log(this.createComponent?.unit); // createComponent is always UNDEFINED }
It is the same issue without solutions than this alert since 5 years:https://stackoverflow.com/questions/51959167/angula6-viewchild-in-ng-bootstrap-ng-bootstrap-ngbmodalmodule-modal-returns-und