M
M
mechanicnikodimich2016-11-19 15:42:44
Angular
mechanicnikodimich, 2016-11-19 15:42:44

Routes not working in modules for parent element?

Good afternoon everyone!
I can’t figure out the routes module, the problem is this:
There is an app component that contains a toolbar.
Routes module:

const appRoutes: Routes = [

    {
        path: '',
        children: [
            //{ path: '', redirectTo: 'general-info' },
            {
                path: '',
                loadChildren: 'app/passport/generalInfo/shared/general-info.module#GeneralInfoModule'
            },
            { path: 'medtech', component: AppComponent }
        ]
    }

];


@NgModule({
    imports: [
        RouterModule.forRoot(appRoutes)
    ],
    exports: [
        RouterModule
    ]
})

export class AppRoutingModule { }

There are no problems here, the routing works fine and the next module is loaded or the component is opened (I use appComponent, because the module has not been written yet).
Thus, we get two modules (module A, with links to the component and to module B).
Next, the routing of module B:
const generalRoutes: Routes = [

   { path: '', redirectTo: 'general-info', pathMatch: 'full'},
  {
    path: 'general-info',  component: GeneralInfoComponent,
    children: [
      
       { path: '', loadChildren: 'app/passport/generalInfo/detailInfo/informationMenu/detail-info.module#DetailInfoModule' },
  
       { path: 'bank', component: BankComponent }
    ]
  }


];


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

And in general, everything is repeated, there is a link to the C module and to the component.
When switching to the component of module B (BankComponent), you can safely switch to the component of module A (AppComponent).
But if we follow the link to module C, then we fail to navigate to the component of module A (AppComponent) (an error occurs).
Uncaught (in promise): TypeError: undefined is not an object (evaluating 'outlet.outletMap._outlets')

Tell me what could be the problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question