Topic: MDB angular - use mdb components in lazy loaded modules
Hello, I followed the getting started guide for ng-mdb-pro through npm - git. (v 4.4.3) When i try to use mdb components in lazy loaded modules they don't work. As a result i have to load again MDBBootstrapModules.forRoot(), in every child module that will be lazy loaded. If i need to use some mdb component in the app module and a child lazy module also needs to use mdb components i have to reload MDB in both of them. As a result some singleton injectables are loaded twice. The angular compiler complaints that i am reloading an already declared provider e.t.c Why is that happening? Shouldn't the MDBBootstrapModules.forRoot(), be called just once in app.module.ts and be done with it?
Good evening, I need help, I feel like I'm going crazy. I have read most of the questions that you have asked regarding the lazy module and the implementation of this library. In my app.module.ts I import mdb and all good, the components that are loaded by this module, work correctly, I can have mdb code in my components. But when using it in other components that are loaded by other modules, it is when the error occurs. I tried to do a mdbSharedModule, but it still gives me error ... PLEASE HELP!
Dear georgegtx, within before MDB 4.3.7 we used to include Alert/Toastr module inside MDBootstrapModule however within Angular update it became an issue. We have fixed that in release 4.3.7 since when, ToastModule should be loaded separately from MDBootstrapModule. This have been described in detail in our changelog: https://mdbootstrap.com/angular/changelog/ as well as Toast documentation: https://mdbootstrap.com/angular/advanced/alerts/ You should import it once, and import ToastService in components which are supposed to initiate alerts. If you are using version lower than 4.3.7 please check following workaround. https://mdbootstrap.com/support/bug-with-the-lazy-loading/
I got the same issue. First, no AOT build, and now no lazy loading module. I am starting to regret purchasing this product. So sad that supporters have no response for a long time.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Specification of the issue
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No