0

我在 MDB angular 上创建新项目时遇到了这个问题。我创建了多个模块,例如 public、tutor 和 student 。公共模块不是延迟加载的,而其他模块是延迟加载的。公共模块工作完美。

import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform- 
browser/animations';
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AgmCoreModule } from '@agm/core';
import { AppComponent } from './Main/app.component';

import { SharedModule } from './shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
import { PublicModule } from './public/public.module';
import { PageNotFoundComponent } from './Main/page-not-found/page-not- 
found.component';
import { ToastModule } from 'ng-uikit-pro-standard';
import { CoreModule } from './core/core.module';

@NgModule({
declarations: [
AppComponent,
PageNotFoundComponent
],
imports: [
PublicModule,
CoreModule,
AppRoutingModule,
BrowserModule,
ToastModule.forRoot(),
BrowserAnimationsModule,
FormsModule,
SharedModule,
AgmCoreModule.forRoot({
  // https://developers.google.com/maps/documentation/javascript/get-api- 
  key?hl=en#key
  apiKey: 'Your_api_key'
})
 ],
 bootstrap: [AppComponent],
schemas:      [ NO_ERRORS_SCHEMA ]
})
export class AppModule { }





import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PageNotFoundComponent } from './Main/page-not-found/page-not- 
found.component';

const routes: Routes = [
{ path: 'tutor', loadChildren: './tutor/tutor.module#TutorModule' },
// { path: 'admin', loadChildren: './admin/admin.module#AdminModule' },
 //  { path: '**', component: PageNotFoundComponent}
 ];

 @NgModule({
imports: [RouterModule.forRoot(routes)],
 exports: [RouterModule]
})
export class AppRoutingModule { }



import { NgModule } from '@angular/core';

import { TutorRoutingModule } from './tutor-routing.module';
import { SharedModule } from '../shared/shared.module';
import { TutorLayoutComponent } from './tutor-layout/tutor- 
layout.component';

@NgModule({
declarations: [TutorLayoutComponent],
imports: [
SharedModule,
TutorRoutingModule
 ]
})
 export class TutorModule { }



import { NgModule } from '@angular/core';
  import { Routes, RouterModule } from '@angular/router';
  import { TutorLayoutComponent } from './tutor-layout/tutor- 
 layout.component';

 const routes: Routes = [
 {path: '', component: TutorLayoutComponent}
];

 @NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
 })
 export class TutorRoutingModule { }

我想延迟加载除我的公共模块之外的所有模块。但我不知道为什么它向我显示浏览器模块已加载的消息。我已经尝试过多次尝试来解决它。

4

0 回答 0