Abumaizer pro asked 7 years ago


what is the config for lazy loading?

Dawid Adach pro commented 7 years ago

Dear Abumaizer, could you please make your question more detailed? I am not sure which exactly config do you mean?

Abumaizer pro commented 6 years ago

I keep getting this error during lazy loading even after updating to the last version. i did "npm i" more than once ERROR Error: Uncaught (in promise): Error: ToastModule is already loaded. It should only be imported in your application's main module. Error: ToastModule is already loaded. It should only be imported in your application's main module. I am importing my mdb modules in a sharedModule like this, Start your code here import { NO_ERRORS_SCHEMA, NgModule } from '@angular/core'; import { AgmCoreModule } from '@agm/core'; import { MDBBootstrapModule } from './../../typescripts/free/index'; import { MDBBootstrapModulePro } from '../../typescripts/pro/index'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { ToastModule } from './../../typescripts/pro/alerts/toast/toast.module'; import { CommonModule } from '@angular/common'; import { MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule, MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, MatStepperModule, } from '@angular/material'; import { Ng2SmartTableModule } from 'ng2-smart-table'; import {FlexLayoutModule} from '@angular/flex-layout'; import { NgxDatatableModule } from '@swimlane/ngx-datatable';   @NgModule({ declarations: [ ], imports: [ CommonModule, FlexLayoutModule, MDBBootstrapModule, MDBBootstrapModulePro, NgbModule, MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatStepperModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule, MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, ToastModule.forRoot(), MDBBootstrapModule.forRoot(), MDBBootstrapModulePro.forRoot(), NgbModule.forRoot(), AgmCoreModule.forRoot({ // https://developers.google.com/maps/documentation/javascript/get-api-key?hl=en#key apiKey:'AIzaSyCfA7uau3ly8FssNKl6mvr-QOYo9CqYYdY' }), NgxDatatableModule, Ng2SmartTableModule ], exports: [ ToastModule, FlexLayoutModule, MDBBootstrapModule, MDBBootstrapModulePro, NgbModule, MatAutocompleteModule, MatButtonModule, MatButtonToggleModule, MatCardModule, MatCheckboxModule, MatChipsModule, MatStepperModule, MatDatepickerModule, MatDialogModule, MatExpansionModule, MatGridListModule, MatIconModule, MatInputModule, MatListModule, MatMenuModule, MatNativeDateModule, MatPaginatorModule, MatProgressBarModule, MatProgressSpinnerModule, MatRadioModule, MatRippleModule, MatSelectModule, MatSidenavModule, MatSliderModule, MatSlideToggleModule, MatSnackBarModule, MatSortModule, MatTableModule, MatTabsModule, MatToolbarModule, MatTooltipModule, AgmCoreModule, NgxDatatableModule, Ng2SmartTableModule ], schemas: [ NO_ERRORS_SCHEMA ] }) export class SharedModule {}

Dawid Adach pro commented 6 years ago

Do you load module in any ohter place? please not that you should load it once per module and load service in components whereas you are willing to use notifications.

Abumaizer pro commented 6 years ago

yes the module is imported in other modules too. Now I changed the implementation, I imported ToastModule.forRoot() in my app module, I am getting a new error ERROR Error: Uncaught (in promise): Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead. Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.

Abumaizer pro answered 6 years ago


resolved, thank u so much

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags