Closed TsengSR closed 7 years ago
I had a problem that was similar and I had to add .forRoot() when importing the module. Might be a hint in this case too.
Cheers
Nope, that results in Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.
which is correct as forRoot should only be called inside the application module
I am facing the same issue :(
Solved for me:
imports: [ ... ModalModule.forRoot(), ... ],
Thought it would help :P
is .forChild() option exposed?? I cannot use it.
You don't need it (forChild()) Check demo/src here to see how it works
This forRoot/forChild semantics just seem wrong in my eyes.
What will happen if we have two modules which both need ng2-bootstrap?
By angular2 "semantics" (for routing module), forRoot should only be called in the app module and not in the lazy loaded ones.
Do we now have to expect, that putting the ng2-bootstrap in another lazy loaded module breaks the application again? Or will then be forced to include ng2-bootstrap in the main application, even if we don't know if any module would ever use it?
No matter how you turn it around, it looks wrong and we shouldn't have to call .forRoot
for anything except the angular2 routing module., which is a core component of the whole angular2 application
I had same filling initially, but I need to split providers from components, and as for now it is recommended way
I'm not fixed yet.The new version of ng2-bootstrap with anguar2 2.0.0, 2.4.0 all have this problem when I use ModalDirective in template.
Are you using .forRoot()?
I fixed this problem using TooltipModule.forRoot() instead of TooltipModule (module from ng2-bootstrap)
@marval2 solution worked for me. Need to add forRoot()
in module import
you can import BsRootModule
ModalModule.forRoot() only runs if the modal is in root component "/", but it's in child fails. I need open modal in a child component. Any solution?
Import modal module in child module without for root
I try it, but doesnt work. When try to load the modal, change to url root. My modal is in '/catalogo', but if I put the modal in route '/' works perfectly.
Stackblitz to reproduce
I found the problem, my button was and in href it had '#', for this, in route / the modal run, but in other route not.
The solution is in root module we need to add with forRout and in child module we need to add only the required module with out forRout. Patent componet BsDatepickerModule.forRoot(), Child component BsDatepickerModule
FIX: use .forRoot() docs preview available here: http://valorkin.github.io/ng2-bootstrap/#/
I am receiving this exception after upgrading to the latest 1.16-x version (from 1.13)
I have an angular2 application with lazy loaded modules. Trying to add
ComponentLoaderFactory
to the NgModule provider list, but its not working neither.My Module definition:
And the app routing module: