From cc768d227f3840ed3bdbf58323e2f0b15340fc65 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Fri, 3 Apr 2020 11:52:48 +0800 Subject: [PATCH] refactor: split home module --- src/app/app-routing.module.ts | 9 ++++--- src/app/app.module.ts | 16 ------------ src/app/presentation/home/home.module.ts | 31 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 src/app/presentation/home/home.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 24b8421c..2c7934d1 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -18,10 +18,6 @@ import { MaturityComponent } from './presentation/maturity/maturity.component'; const routes: Routes = [ { path: '', pathMatch: 'full', redirectTo: '/home' }, - { - path: 'home', - component: HomeComponent, - }, { path: 'case-study', component: CaseStudyComponent, @@ -75,6 +71,11 @@ const routes: Routes = [ loadChildren: () => import('./presentation/design/design.module').then((m) => m.DesignModule), }, + { + path: 'home', + loadChildren: () => + import('./presentation/home/home.module').then((m) => m.HomeModule), + }, { path: 'helper', loadChildren: () => diff --git a/src/app/app.module.ts b/src/app/app.module.ts index cb111b7a..e090128f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -4,13 +4,7 @@ import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { SharedModule } from './shared/shared.module'; -import { PeriodicTableComponent } from './features/periodic-table/periodic-table.component'; -import { AtomComponent } from './features/atom/atom.component'; -import { AtomDetailsComponent } from './features/atom-details/atom-details.component'; -import { AppPhaseComponent } from './features/app-phase/app-phase.component'; -import { AppWikiComponent } from './features/app-wiki/app-wiki.component'; import { HttpClientModule } from '@angular/common/http'; -import { HomeComponent } from './presentation/home/home.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { CustomMaterialModule } from './shared/custom-material.module'; import { CaseStudyComponent } from './presentation/case-study/case-study.component'; @@ -18,7 +12,6 @@ import { PatternComponent } from './presentation/pattern/pattern.component'; import { PractiseComponent } from './presentation/practise/practise.component'; import { ManualComponent } from './presentation/manual/manual.component'; import { FormsModule } from '@angular/forms'; -import { DragulaModule } from 'ng2-dragula'; import { MaturityItemComponent } from './presentation/maturity/maturity-item/maturity-item.component'; import { ResourcesComponent } from './presentation/resources/resources.component'; import { ReporterComponent } from './presentation/reporter/reporter.component'; @@ -26,20 +19,11 @@ import { AwesomeToolComponent } from './presentation/awesome-tool/awesome-tool.c import { MobileComponent } from './presentation/mobile/mobile.component'; import { ThinkTankComponent } from './presentation/think-tank/think-tank.component'; import { SolutionComponent } from './presentation/solution/solution.component'; -import { AtomDialogComponent } from './features/atom-dialog/atom-dialog.component'; import { MaturityComponent } from './presentation/maturity/maturity.component'; @NgModule({ declarations: [ AppComponent, - HomeComponent, - - PeriodicTableComponent, - AtomComponent, - AtomDetailsComponent, - AtomDialogComponent, - AppPhaseComponent, - AppWikiComponent, CaseStudyComponent, PatternComponent, diff --git a/src/app/presentation/home/home.module.ts b/src/app/presentation/home/home.module.ts new file mode 100644 index 00000000..720a8241 --- /dev/null +++ b/src/app/presentation/home/home.module.ts @@ -0,0 +1,31 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HomeComponent } from './home.component'; +import { PeriodicTableComponent } from '../../features/periodic-table/periodic-table.component'; +import { AtomComponent } from '../../features/atom/atom.component'; +import { AtomDetailsComponent } from '../../features/atom-details/atom-details.component'; +import { AtomDialogComponent } from '../../features/atom-dialog/atom-dialog.component'; +import { AppPhaseComponent } from '../../features/app-phase/app-phase.component'; +import { AppWikiComponent } from '../../features/app-wiki/app-wiki.component'; +import { SharedModule } from '../../shared/shared.module'; +import { RouterModule } from '@angular/router'; +import { CustomMaterialModule } from '../../shared/custom-material.module'; + +@NgModule({ + declarations: [ + HomeComponent, + PeriodicTableComponent, + AtomComponent, + AtomDetailsComponent, + AtomDialogComponent, + AppPhaseComponent, + AppWikiComponent, + ], + imports: [ + CommonModule, + SharedModule, + CustomMaterialModule, + RouterModule.forChild([{ path: '', component: HomeComponent }]), + ], +}) +export class HomeModule {}