Когда я выполняю этот код для перенаправления на другой компонент
this.router.navigate(['/distributed-chart/' + this.invested.risk]);
У меня есть эта проблема в консоли:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL
Segment: 'distributed-chart/54f9ef8a84d534d9490002d1'
приложение-routing.module.ts
const routes: Routes = [
{ path: '', redirectTo: 'simulation/simulate-saving-plan', pathMatch: 'full' },
{ path: 'simulation', loadChildren: 'app/simulation/simulation.module#SimulationModule' },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
имитационные-routing.module.ts
const routes: Routes = [
{ path: '', component: SimulationComponent,
children:[
{ path: 'simulate-saving-plan', component: SimulateSavingPlanComponent },
{ path: 'distributed-chart/:risk', component: DistributedChartComponent },
{ path: 'expected-rent-chart', component: ExpectedRentChartComponent },
{ path: 'historic-chart', component: HistoricChartComponent }
]}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SimulationRoutingModule { }