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
+7 -31
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,26 +9,13 @@ 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: ':clientType',
data: { title: extract('Clients'), routeParamBreadcrumb: 'clientType' },
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: '',
// Component to View All existing Loans Comes Here
children: [{
path: ':loanId', path: ':loanId',
data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' }, data: { title: extract('Loan View'), routeParamBreadcrumb: 'loanId' },
// Component For Loan View Comes Here // Component For Loan View Comes Here
@@ -39,22 +23,14 @@ const routes: Routes = [
{ {
path: 'add-loan-charge', path: 'add-loan-charge',
component: AddLoanChargeComponent, component: AddLoanChargeComponent,
data: {title: extract('Add Loan Charge'), breadcrumb: 'Add Loan Charge', routeParamBreadcrumb: false}, data: { title: extract('Add Loan Charge'), breadcrumb: 'Add Loan Charge', routeParamBreadcrumb: false },
resolve: { resolve: {
loanChargeTemplate: LoanChargeTemplateResolver 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 { }