Reputation: 135
I am using this code for routing
{ path: 'dashboard', loadChildren: './dashboard#DashboardModule'},
{ path: '', children: [
{ path: '', component:DashboardComponent, children: [
{ path: '', redirectTo:'dashboard/first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent }]
},
]},
Here when the url is /dashboard
I need it to route to /dashboard/first...
How can I achieve it?
Upvotes: 1
Views: 1659
Reputation: 68685
You are already in Dashboard
component. Use only first
, not dashboard/first
.
{ path: '', children: [
{ path: '', component:DashboardComponent ,
children:[
{ path: '', redirectTo:'first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent },
]
},
]},
Upvotes: 5