New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal: Open components from lazy loaded modules #1861
Comments
This sounds very odd. Could you please provide a minimal plunker illustrating the issue? I'm sorry, but we will need a minimal reproduce scenario to move forward on this one. |
I actually wrap it in a shared module to get global default components. |
Sorry I was a bit quick to close this. I will try to provide a plunker of my problem |
Here is a plunker: https://plnkr.co/edit/oRMVOWVILK211xuITxiH?p=preview Click on the 'Mod 1 Page 1' link and then the different buttons to open shared or lazy loaded content |
I see. The problem is that you are creating / instantiating your shared modal service in root module only (and this is where you are injecting NgbModalService). As the result of your setup you are going to get the Our intention with the There are 2 ways moving forward:
|
Thank you! Yes instead of adding ModalService to the root I add it to every Lazy-Module instead! |
Could anyone show some demo please ? |
Hi guys I'm having the same issue. I also created a complete stackblitz that shows the issue I have. Could you please point me to the right direction? I don't want to move my modal content into the main app.module! |
Bug description:
If I create a component, to be loaded by the modal-service, in a lazy-loaded route it can not be resolved with the error:
And this is since it is created in another context for the lazy loaded module.
So I pass along the
Injector
from the component where I call the modal service, but that did not work as the ComponentResolveFactory for the current context is not used.A fix would be to get the ComponentFactoryResolver from the passed injector.
modal-stack.ts
I have tried to edit the downloaded npm package and tried to create a pull-request, but could not get the tests to pass as it could not fond an instance of ComponentFactoryModule.
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 4.3.6
ng-bootstrap: 1.0.0-beta.5
Bootstrap: 4.0.0-beta
The text was updated successfully, but these errors were encountered: