fix: make system and product module routes accessible (#384)

- Refactor loans-routing.module.ts to be lazy loaded in required modules.

Fixes: #383
This commit is contained in:
Jivjyot Singh
2019-03-02 20:22:56 +05:30
committed by Abhay Chawla
parent 9944dcce93
commit 5ba3daf223
2 changed files with 18 additions and 43 deletions
+1 -2
View File
@@ -33,7 +33,7 @@ import { AccountingModule } from './accounting/accounting.module';
import { SelfServiceModule } from './self-service/self-service.module';
import { SystemModule } from './system/system.module';
import { ProductsModule } from './products/products.module';
import { LoansModule } from './loans/loans.module';
/** Main Routing Module */
import { AppRoutingModule } from './app-routing.module';
@@ -61,7 +61,6 @@ import { AppRoutingModule } from './app-routing.module';
CentersModule,
AccountingModule,
SelfServiceModule,
LoansModule,
SystemModule,
ProductsModule,
AppRoutingModule
+17 -41
View File
@@ -2,9 +2,6 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
/** Routing Imports */
import { Route } from '../core/route/route.service';
/** Translation Imports */
import { extract } from '../core/i18n/i18n.service';
@@ -12,49 +9,28 @@ import { extract } from '../core/i18n/i18n.service';
import { AddLoanChargeComponent } from './add-loan-charge/add-loan-charge.component';
/** Custom Resolvers */
import {LoanChargeTemplateResolver} from './common-resolvers/loan-charge-template.resolver';
import { LoanChargeTemplateResolver } from './common-resolvers/loan-charge-template.resolver';
const routes: Routes = [
Route.withShell([
{
path: ':clientType',
data: { title: extract('Clients'), routeParamBreadcrumb: 'clientType' },
{
path: '',
// Component to View All existing Loans Comes Here
children: [{
path: ':loanId',
data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' },
// Component For Loan View Comes Here
children: [
{
path: 'view',
children: [
{
path: ':clientId',
data: { title: extract('Client View'), routeParamBreadcrumb: 'clientId' },
children: [
{
path: 'loans',
data: { title: extract('All Loans'), breadcrumb: 'Loans', routeParamBreadcrumb: false },
children: [
{
path: ':loanId',
data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' },
// Component For Loan View Comes Here
children: [
{
path: 'add-loan-charge',
component: AddLoanChargeComponent,
data: {title: extract('Add Loan Charge'), breadcrumb: 'Add Loan Charge', routeParamBreadcrumb: false},
resolve: {
loanChargeTemplate: LoanChargeTemplateResolver
}
}
]
}
]
}
]
}
]
path: 'add-loan-charge',
component: AddLoanChargeComponent,
data: { title: extract('Add Loan Charge'), breadcrumb: 'Add Loan Charge', routeParamBreadcrumb: false },
resolve: {
loanChargeTemplate: LoanChargeTemplateResolver
}
}
]
}
])
}]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
@@ -62,4 +38,4 @@ const routes: Routes = [
declarations: [],
providers: [LoanChargeTemplateResolver]
})
export class LoansRoutingModule {}
export class LoansRoutingModule { }