Let's imagine. We have such routes:
import { ViewComponent } from '../view.component';
export const routes: Routes = [
{
path: '',
pathMatch: 'full',
component: ViewComponent,
children: [
{
path: '',
pathMatch: 'full',
redirectTo: 'about'
},
{
path: 'about',
loadChildren: 'app/views/about/about.module#AboutModule'
}
]
},
{
path: 'auth'
pathMatch: 'full',
loadChildren: 'app/views/auth/auth.module#AuthModule'
}
{
path: '**',
redirectTo: ''
}
];
import { AboutComponent } from './about.component';
export const aboutRoutes: Routes = [
{
path: ''
component: AboutComponent
}
];
import { SignUpComponent } from './sign-up.component';
import { SignInComponent } from './sign-in.component';
export const authRoutes: Routes = [
{
path: ''
pathMatch: 'full',
redirectTo: 'sign-in'
},
{
path: 'sign-up'
redirectTo: SignUpComponent
},
{
path: 'sign-in'
component: SignInComponent
},
{
path: 'sign-in/:id'
component: SignInComponent
},
];
import { LocationComponent } from './location.component';
export const locationRoutes: Routes = [
{
path: ''
component: LocationComponent
}
];