I have a class component, that has two subcomponents called students and stats. I have these routes configured for them for now:
const routes: Routes = [
{
path: '', component: ClassComponent, children: [
{ path: 'students', component: StudentsComponent },
{ path: 'stats', component: StatsComponent }
]
}
];
And class itself is the child of another component called school.
Now routes are working fine in this level. That is, when browser URL is changed to domain.com/class/students I get students component, and when it's changed to domain.com/class/stats I get stats component.
However, now I need to pass classId as a parameter to the aforementioned routing. I'm stuck at this point, as I have no idea how to include that parameter in routes. Any help is appreciated.
Update: I know that I can have /class/students/1 and /class/stats/1 routes. What I want is to have them like this: /class/1/students and /class/1/stats and also define them only in the class component, not in the children component, and access them both in parent and children components.