私はアプリケーションに遅延ルーティングを実装しようとしています。RangeError:最大呼び出しスタックサイズを超えました遅延ルーティング角度2
私は非常に大きなプロジェクトを持っていて、ルータで廃止されたときにAsyncRouteを使用しましたが、今は削除されました。
は、だから私は、最新の遅延ロードを実装しようとしたが、私は問題 例外RangeErrorを得た:最大コールスタックのサイズは、私が間違ってやっている何 を超えましたか?私は指示のようにすべてのコードをしました。
は見てくださいEncountersModuleここ
import { NgModule } from '@angular/core';
// import { CommonModule } from '@angular/common';
/* --------------- !System modules --------------- */
import { SharedModule } from 'sharedModule'; //There is a lot of shared components/directives/pipes (over 60) and it re-exports CommonModule so I can't avoid it
/* --------------- !App outer modules --------------- */
import { EncountersComponent } from './encounters.component';
// import { PassCodeComponent } from '../../shared/components/passcode/passcode.component';
@NgModule({
imports: [ SharedModule ],
declarations: [ EncountersComponent],
exports: [ EncountersComponent ],
})
export class EncountersModule { }
私app.routing.module
import { NgModule } from '@angular/core';
// import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ImagingComponent } from '../modules/index';
import { DashboardComponent } from '../modules/index';
import { PrescriptionNoticesComponent } from '../modules/index';
// import { EncountersComponent } from "../modules/encounters/encounters.component";
import { ScheduleComponent } from "../modules/schedule/schedule.component";
import { AdminComponent } from '../modules/index';
@NgModule({
imports: [
RouterModule.forRoot([
{
path: '',
component: DashboardComponent,
data: { label: 'Dashboard' }
},
{
path: 'encounters',
// component: EncountersComponent,
loadChildren: 'production/modules/encounters/encounters.module#EncountersModule',
data: { label: 'Encounters' }
},
{
path: 'admin',
component: AdminComponent,
data: { label: 'Admin' }
}
])
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}
// const appRoutes: Routes = [
// {
// path: 'imaging',
// component: ImagingComponent,
// data: { label: 'Imaging' }
// },
// {
// path: '',
// component: DashboardComponent,
// data: { label: 'Dashboard' }
// },
// {
// path: 'prescription_notices',
// component: PrescriptionNoticesComponent,
// data: { label: 'Prescription Notices' }
// },
// {
// path: 'encounters',
// component: EncountersComponent,
// data: { label: 'Encounters' }
// },
// {
// path: 'schedule',
// component: ScheduleComponent,
// data: { label: 'Schedule' }
// },
// {
// path: 'admin',
// component: AdminComponent,
// data: { label: 'Admin' }
// }
// ];
//
// export const appRoutingProviders: any[] = [
//
// ];
//
// export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
おそらく私がencounters.module – Velidan
のための任意のルーティングを持っていなかったので、おそらくコメントを削除してみてください。私が作業していたアプリケーションで現在のルータにアップデートしたとき、私はそれを失いたくないので、古いルータからたくさんのものをコメントしました。コメントを削除した後、奇妙なエラーのいくつかは消え去った。私はすべてのコメントを自分のコードの上に掲載していましたが、ここに該当するかどうかはわかりません。 – Frank
おかげさまでフランクにお手伝いします! – Velidan