Load component which is linked to a route parameter

Viewed 22

Do you know if it is possible de load a component that is link to a route parameter directly inside the route config.

For exemple, I have Exicise1Component Exicise2Component Exicise3Component...

I would like to handle the loading inside router config :

const routes: Routes = [
  {
    path: 'exercises/:id',
    component: Exercise + id
  }
];

I would like to avoid creating a route for each Exercise component.

Do you have an idea ? Or a better way ?

0 Answers
Related