In my CRM module, I have created a custom Routing Module like this:
const routes: Routes = [
{
path: 'crm',
component: CrmComponent,
children: [
{ path: '', redirectTo: 'companies', pathMatch: 'full' },
{ path: 'companies', component: CompanyListComponent },
{ path: 'contacts', component: ContactListComponent },
{
path: 'companies/new',
component: CompanyEditComponent,
canDeactivate: [CanDeactivateGuardService],
},
{
path: 'contacts/new',
component: ContactEditComponent,
canDeactivate: [CanDeactivateGuardService],
},
// more routing configurations
],
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class CRMRoutingModule {}