valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

Ngx Bootstrap modal and viewchild component is always undefined #6627

Open cheikhnadiouf opened 9 months ago

cheikhnadiouf commented 9 months ago

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

lexasq commented 2 months ago

You refer to ng-bootstrap in your stack-overflow reference. Thats another library.