RangeError: Maximum call stack size exceeded Lazy routing Angular 2

后端 未结 7 854
礼貌的吻别
礼貌的吻别 2020-12-13 23:38

I\'m trying to implement lazy routing into my app.

I have a very big project and when it was at router-deprecated I used AsyncRoute, but now it was removed.

相关标签:
7条回答
  • 2020-12-14 00:23

    I had the same error. I had four modules inside my angular app.

    ERROR in Maximum call stack size exceeded
    

    My Error

    I had created a routing file inside a module manually and that file was not imported in module.ts file. So you need to import the routing file in your module.ts file.

    import { NgModule } from '@angular/core';
    import { CommonModule } from '@angular/common';
    import { UserLoginComponent } from './user-login/user-login.component';
    import { UserSignupComponent } from './user-signup/user-signup.component';
    import { PublicComponent } from './public/public.component';
    import { PublicRoutingModule } from './public-routing.modue'; //import it first
    
    @NgModule({
      declarations: [UserLoginComponent, UserSignupComponent, PublicComponent],
      imports: [
        CommonModule,
        PublicRoutingModule // I was missing this line
      ]
    })
    export class PublicModule { }
    

    Alert: This module file is not app.module.ts

    0 讨论(0)
提交回复
热议问题