Base solution for your next web application
Open Closed

How to define and use child route in router #7665


User avatar
0
FlexSolution created

Hi, I have problems creating child routes in main routing module.

{ path: 'vehicles/vehicles', component: VehiclesComponent, data: { permission: 'Pages.Vehicles' }, children: [{ path: 'statistic', component: StatisticVehicleComponent }] },

and I'm trying to redirect to it from code:

this.router.navigate(['/app/main/vehicles/vehicles/statistic']).then(() => {
            window.location.reload();
        });

but I'm always getting error that route doesn't exist.

What I'm doing wrong, should I register somewhere else the route or I'm calling this router in wrong way?


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @FlexSolution

    I have implemented a similar scenario and it worked for me. Could you share the exact error message ?

    By the way, have you included <router-outlet></router-outlet> into your Vehicles component ? It will be required to display the StatisticVehicleComponent.