Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 8a3b231

Browse files
authored
Merge pull request #28 from Only1MrAnderson/master
updated all components to lazy loaded
2 parents 68fe3f5 + 0595b30 commit 8a3b231

File tree

12 files changed

+92
-22
lines changed

12 files changed

+92
-22
lines changed

src/app/app.module.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
import { BrowserModule } from '@angular/platform-browser';
2-
import { NgModule } from '@angular/core';
32
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
3+
import { NgModule } from '@angular/core';
44
import { MatToolbarModule, MatSidenavModule, MatIconModule, MatButtonModule, MatListModule } from '@angular/material';
5-
import { RouterModule } from '@angular/router';
6-
7-
import { RXJS_DOC_ROUTES } from './app.routing';
5+
import { RouterModule, PreloadAllModules } from '@angular/router';
86

97
import { AppComponent } from './app.component';
10-
import { OperatorsComponent } from './operators/operators.component';
11-
import { CompaniesComponent } from './companies/companies.component';
12-
import { TeamComponent } from './team/team.component';
13-
import { RxjsComponent } from './rxjs/rxjs.component';
8+
import { RXJS_DOC_ROUTES } from './app.routing';
149

1510
@NgModule({
1611
declarations: [
1712
AppComponent,
18-
OperatorsComponent,
19-
CompaniesComponent,
20-
TeamComponent,
21-
RxjsComponent
2213
],
2314
imports: [
2415
BrowserModule,
2516
BrowserAnimationsModule,
26-
RouterModule.forRoot(RXJS_DOC_ROUTES),
17+
RouterModule.forRoot(RXJS_DOC_ROUTES, { preloadingStrategy: PreloadAllModules }),
2718
MatToolbarModule,
2819
MatSidenavModule,
2920
MatIconModule,

src/app/app.routing.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { RxjsComponent } from './rxjs/rxjs.component';
77
import { TeamComponent } from './team/team.component';
88

99
export const RXJS_DOC_ROUTES: Routes = [
10-
{ path: '', component: RxjsComponent },
11-
{ path: 'operators', component: OperatorsComponent },
12-
{ path: 'team', component: TeamComponent },
13-
{ path: 'companies', component: CompaniesComponent },
10+
{ path: '', loadChildren: './rxjs/rxjs.module#RxjsModule' },
11+
{ path: 'operators', loadChildren: './operators/operators.module#OperatorsModule' },
12+
{ path: 'team', loadChildren: './team/team.module#TeamModule' },
13+
{ path: 'companies', loadChildren: './companies/companies.module#CompaniesModule' },
1414
{ path: '**', redirectTo: '' }
1515
];

src/app/companies/companies.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export class CompaniesComponent implements OnInit {
1111

1212
ngOnInit() {
1313
}
14-
1514
}
15+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { CompaniesComponent } from './companies.component';
4+
import { routing } from './companies.routing';
5+
6+
@NgModule({
7+
imports: [routing],
8+
declarations: [CompaniesComponent]
9+
})
10+
export class CompaniesModule { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
import { CompaniesComponent } from './companies.component';
5+
6+
const routes: Routes = [
7+
{ path: '', component: CompaniesComponent }
8+
];
9+
10+
export const routing: ModuleWithProviders = RouterModule.forChild(routes);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { OperatorsComponent } from './operators.component';
4+
import { routing } from './operators.routing';
5+
6+
@NgModule({
7+
imports: [routing],
8+
declarations: [OperatorsComponent]
9+
})
10+
export class OperatorsModule { }
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
import { OperatorsComponent } from './operators.component';
5+
6+
const routes: Routes = [
7+
{ path: '', component: OperatorsComponent }
8+
];
9+
10+
export const routing: ModuleWithProviders = RouterModule.forChild(routes);

src/app/rxjs/rxjs.module.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { RxjsComponent } from './rxjs.component';
4+
import { routing } from './rxjs.routing';
5+
6+
@NgModule({
7+
imports: [routing],
8+
declarations: [RxjsComponent]
9+
})
10+
export class RxjsModule { }

src/app/rxjs/rxjs.routing.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ModuleWithProviders } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
import { RxjsComponent } from './rxjs.component';
5+
6+
const routes: Routes = [
7+
{ path: '', component: RxjsComponent }
8+
];
9+
10+
export const routing: ModuleWithProviders = RouterModule.forChild(routes);

src/app/team/team.module.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { TeamComponent } from './team.component';
4+
import { routing } from './team.routing';
5+
6+
@NgModule({
7+
imports: [routing],
8+
declarations: [TeamComponent]
9+
})
10+
export class TeamModule { }

0 commit comments

Comments
 (0)