0

我需要将注册模块从角度库延迟加载到我的角度应用程序中。

在这里,您可以在下面看到我正在尝试将“reg_outlet”用于延迟加载的注册模块。但是,这样做,我得到了错误:

错误:无法匹配任何路由。网址段:

register.component.html

<router-outlet>
</router-outlet>

注册-routing.module.ts

const routes: Routes = [
   {
      path: '',
      component: RegisterComponent,
      children: [
         { path: '', pathMatch: 'full', 
         canActivate: [RegistrationRoutingGuard],
      },
         { path: routesConst['RegistrationIdComponent'], component: RegistrationIdComponent, canDeactivate: [GoBackGuard]  },
      ]
   }
];

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

应用程序路由.module.ts

const routes: Routes = [
  
    {
        path: '',
        pathMatch: 'full',
        redirectTo: '/register',
    },
    {
      path: 'register',
      loadChildren: () => import('nid-lib/lib/register').then(m => m.RegisterModule),
      outlet: 'reg_outlet'
    },
    {
      path: 'forgot',
      loadChildren: () => import('nid-lib/lib/forgot').then(m => m.ForgotModule),
    }
  ];

@NgModule({
    imports: [RouterModule.forRoot(routes, {preloadingStrategy: PreloadAllModules, useHash: true})],
    exports: [RouterModule]
 })

app.component.html

<router-outlet>
</router-outlet>

<router-outlet name="reg_outlet">
</router-outlet>
4

0 回答 0