My router is like this.
@NgModule({
imports: [
RouterModule.forChild([
{
path: '',
component: AppComponent,
children: [
{path: '', redirectTo: '/home', pathMatch: 'full'},
{ path: 'home', component: HomeComponent, canActivate: [AppRouteGuard] },
{ path: 'books', component: BooksComponent, data: { permission: 'Pages.Books' }, canActivate: [AppRouteGuard] },
{ path: 'books/detail/:id', component: BooksComponent, data: { permission: 'Pages.Books' }, canActivate: [AppRouteGuard]},
{ path: '**', redirectTo: '/app/home'}
]
}
])
],
exports: [RouterModule]
})
So when a user select a book from book page send book id to get details and url will be like
http://localhost:4200/app/prospects/detail/2045
But I don't want a user to type this url manually to get the details. Is there any way to redirect to home if a user types url manually?