Angular router navigation to children routes

244 Views Asked by At

This is how a route in my app-routing-module looks like.

{
    path: 'subjects/:subjectId', component: MainComponent, canActivate: [AuthGuard],
    children: [
      {
        path: 'slideset/:slidesetId',
        component: MainComponent
      },
      {
        path: 'exercise/:exerciseId',
        component: MainComponent
      }
    ]
  }

Now in one of my components when I try to do this,

this.router.navigate(['/subjects', studyFile.subjectId, studyFile.id ]);

it never redirects me to this path 'slideset/:slidesetId' I am not been able to figure out why? or is this this right way to navigate to child component?

0

There are 0 best solutions below