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 { SelfServiceModule } from './self-service/self-service.module';
import { SystemModule } from './system/system.module'; import { SystemModule } from './system/system.module';
import { ProductsModule } from './products/products.module'; import { ProductsModule } from './products/products.module';
import { LoansModule } from './loans/loans.module';
/** Main Routing Module */ /** Main Routing Module */
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
@@ -61,7 +61,6 @@ import { AppRoutingModule } from './app-routing.module';
CentersModule, CentersModule,
AccountingModule, AccountingModule,
SelfServiceModule, SelfServiceModule,
LoansModule,
SystemModule, SystemModule,
ProductsModule, ProductsModule,
AppRoutingModule AppRoutingModule
+17 -41
View File
@@ -2,9 +2,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
/** Routing Imports */
import { Route } from '../core/route/route.service';
/** Translation Imports */ /** Translation Imports */
import { extract } from '../core/i18n/i18n.service'; 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'; import { AddLoanChargeComponent } from './add-loan-charge/add-loan-charge.component';
/** Custom Resolvers */ /** Custom Resolvers */
import {LoanChargeTemplateResolver} from './common-resolvers/loan-charge-template.resolver'; import { LoanChargeTemplateResolver } from './common-resolvers/loan-charge-template.resolver';
const routes: Routes = [ const routes: Routes = [
Route.withShell([ {
{ path: '',
path: ':clientType', // Component to View All existing Loans Comes Here
data: { title: extract('Clients'), routeParamBreadcrumb: 'clientType' }, children: [{
path: ':loanId',
data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' },
// Component For Loan View Comes Here
children: [ children: [
{ {
path: 'view', path: 'add-loan-charge',
children: [ component: AddLoanChargeComponent,
{ data: { title: extract('Add Loan Charge'), breadcrumb: 'Add Loan Charge', routeParamBreadcrumb: false },
path: ':clientId', resolve: {
data: { title: extract('Client View'), routeParamBreadcrumb: 'clientId' }, loanChargeTemplate: LoanChargeTemplateResolver
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
}
}
]
}
]
}
]
}
]
} }
] ]
} }]
]) }
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
@@ -62,4 +38,4 @@ const routes: Routes = [
declarations: [], declarations: [],
providers: [LoanChargeTemplateResolver] providers: [LoanChargeTemplateResolver]
}) })
export class LoansRoutingModule {} export class LoansRoutingModule { }