Имя маршрутизатора-выхода, отображаемое в URL-адресе. Как это удалить Я нашел тот же вопрос в StackOverflow вот есть ссылка, но там ответа не дали. поэтому я опубликовал это снова. В моем URL-адресе проекта показано: http://localhost:4200/dashboard/(dashboardSection:profile)
но я хочу сделать так:
http://localhost:4200/dashboard/profile
http://localhost:4200/dashboard/list
Я предоставил весь код для маршрутизации.
app.module.ts
const appRoutes: Routes = [
{ path: 'home', component: HomeComponent},
{ path: 'sign-up', component: SignUpComponent, canActivate: [PreventLoggedInAccess] },
{ path: 'file', component: FileUploadComponent, canActivate: [AuthGuard] },
{ path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard],
children:[
{
path: "list",
component: ListingListComponent,
outlet: 'dashboardSection'
},
{
path: "profile",
component: ProfileEditComponent,
outlet: 'dashboardSection'
}
]
},
{ path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{ path: '**', component: PageNotFoundComponent }
];
в разделе импорта @NgModule({});
RouterModule.forRoot(
appRoutes,
{ enableTracing: false } // <-- debugging purposes only
),
dashboard.component.html
<li [routerLink]="['/dashboard',{ outlets: { dashboardSection: ['list'] }}]" routerLinkActive="active">List</li>
<li [routerLink]="['/dashboard',{ outlets: { dashboardSection: ['profile'] } }]" routerLinkActive="active">profile</li>