Permalink
Browse files

Swich to lazy loading

  • Loading branch information...
1 parent 1290f2a commit c0a280242330c97bf055c5d331cfd1cc75f99a5c @mauricedb committed Jan 2, 2017
Showing with 5 additions and 8 deletions.
  1. +3 −6 src/app/app.module.ts
  2. +1 −1 src/app/mod1/mod1.module.ts
  3. +1 −1 src/app/mod2/mod2.module.ts
@@ -6,10 +6,9 @@ import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
-import { Mod1Module } from './mod1/mod1.module';
-import { Mod2Module } from './mod2/mod2.module';
-
const routes: Routes = [
+ { path: 'books', loadChildren: './mod1/mod1.module#Mod1Module' },
+ { path: 'authors', loadChildren: './mod2/mod2.module#Mod2Module' },
];
const routerModule = RouterModule.forRoot(routes);
@@ -21,9 +20,7 @@ const routerModule = RouterModule.forRoot(routes);
BrowserModule,
FormsModule,
HttpModule,
- routerModule,
- Mod1Module,
- Mod2Module
+ routerModule
],
providers: [],
bootstrap: [AppComponent]
@@ -5,7 +5,7 @@ import { Routes, RouterModule } from '@angular/router';
import { BooksComponent } from './books/books.component';
const routes: Routes = [
- { path: 'books', component: BooksComponent },
+ { path: '', component: BooksComponent },
];
@NgModule({
@@ -5,7 +5,7 @@ import { Routes, RouterModule } from '@angular/router';
import { AuthorsComponent } from './authors/authors.component';
const routes: Routes = [
- { path: 'authors', component: AuthorsComponent },
+ { path: '', component: AuthorsComponent },
];
@NgModule({

0 comments on commit c0a2802

Please sign in to comment.