Reputation: 115
I have a project based on angular2-webpack-starter seed project and I am attempting to integrate ng-bootstrap - specifically modals.
I have a SharedModule where I import NgbModule and re-export it. Every other module in my application imports SharedModule.
I have configured ngbModalContainer in my app.component.html as per the docs.
I now have a lazy loaded module that needs to open a modal. When I try and call the open(...) method on the NgbModal service I am getting an error stating that it can't find the container:
Missing modal container, add to one of your application templates.
I assume this is because the lazy loaded module is importing SharedModule and is receiving a separate instance of the NgbModal service than the root app module.
My question is - what is the correct way to configure this so NgbModal (and the rest of ng-bootstrap services/components) are available application wide, including lazy loaded modules.
Thanks!
Upvotes: 3
Views: 3003
Reputation: 36
In root module(app.module.ts) imports NgbModule.forRoot() then lazy loaded module import NgbModule
Upvotes: 2