0

I'm having a really difficult time trying to figure out why the TEST 1 children aren't loading the current component

Test1ListComponent view displays after I route to Test1ChildComponent. The URL changes, but Test1ChildComponent view does not load

Route tree:

app-routing.module

const routes: Routes = [
  {
    path: '',
    pathMatch: 'full'
  },
  {
    path: 'app',
    loadChildren: './core/core.module#CoreModule'
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

core-routing.module

const routes: Routes = [
  {
    path: '',
    redirectTo: '/', 
    pathMatch: 'full'
  },
  {
    path: 'test1',
    loadChildren: '../test1/test1.module#Test1Module'
  },
];

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

test1-routing.module

const routes: Routes = [
  {
    path: '',
    redirectTo: 'test1',
    pathMatch: 'full'
  },
  {
    path: '',
    component: Test1ListComponent,
    data: {
      displayName: 'Test1'
    },
    children: [
      {
        path: 'test1/:testId',
        component: Test1ChildComponent,
        data: {
          displayName: 'Test1Child'
        },
    children: [
          {
            path: 'test2/:testId',
            component: Test2hildComponent,
            data: {
              displayName: 'Test2Child'
            }
          }
        ]
      }
    ]
  },
];
Davis
  • 2,937
  • 3
  • 18
  • 28
  • All components have the `` – Davis Jun 10 '18 at 20:22
  • I can get to `Test1ListComponent`, but when I land on the Test1ChildComponent with the correct path, the url changes, but I remain on the `Test1ListComponent` view – Davis Jun 10 '18 at 20:23

1 Answers1

0
const routes: Routes = [
  {
    path: '',
    redirectTo: 'test1',
    pathMatch: 'full'
  },
  {
    path: 'test1',
    component: Test1ListComponent,
    data: {
      displayName: 'Test1'
    },
    children: [
      {
        path: '',
        redirectTo: 'test1',
        pathMatch: 'full'
      },
      {
        path: 'test1/:testId',
        component: Test1ChildComponent,
        data: {
          displayName: 'Test1Child'
        },
        children: [
          {
            path: 'test2/:testId',
            component: Test2hildComponent,
            data: {
              displayName: 'Test2Child'
            }
          }
        ]
      }
    ]
  },
];
izmaylovdev
  • 1,828
  • 8
  • 16