Open pgrzywaczcic opened 4 years ago
I think this is related to this https://github.com/angular/angular/issues/14324. I have encountered that same problem using modals.
I think it is. Since they are calling this a feature, maybe a workaround is needed?
Some guy suggested storing ComponentFactoryResolver aware of that component somewhere where it can be retrieved. So if I know a component will be rendered with BsModalService, I can first register that component with it's ComponentFactoryResolver instance.
An other solution would be to allow passing a ComponentFactoryResolver instance to BsModalService.show()
For anyone having this issue: Try adding this in the Module it's declared.
entryComponents: [YourComponent],
@DeeNeon It's not as simple as that when the module that contains the entryComponents
declaration is lazy loaded.
Don't use it in a lazy loaded module then and use a shared.module :)
When trying to display a modal with a component from a dynamically loaded module and using BsModalService registered in AppModule, it fails:
The only workaround I found was to have ModalModule.forRoot() registered in the dynamic module, however this is not optimal.
This issue wasn't present in Angular 6
I tested this with ngx-bootstrap 5.4.0, 5.3.2, 5.20 and Angular 8.2.16