Initial Code

Let's imagine. We have such routes:

  • App - root

  • About - App's child

  • Auth - lazy module that has a direct connection to App

  • Location - detached (nearby) eager module that imported into App and has its routes

  • NotFound - wildcard, the default behavior for not matched paths

Initial Code

Below is only the code of the routes files

import { ViewComponent } from '../view.component';

export const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    component: ViewComponent,
    children: [
      {
        path: '',
        pathMatch: 'full',
        redirectTo: 'about'
      },
      {
        path: 'about',
        loadChildren: 'app/views/about/about.module#AboutModule'
      }
    ]
  },
  {
    path: 'auth'
    pathMatch: 'full',
    loadChildren: 'app/views/auth/auth.module#AuthModule'
  }
  {
    path: '**',
    redirectTo: ''
  }
];

Now we're going to integrate routeshub into the project.

Last updated