Differenzansicht 14-lazyloading
im Vergleich zu 13-search

← Zurück zur Übersicht | Demo | Quelltext auf GitHub
src/app/app.routes.ts CHANGED
@@ -1,12 +1,21 @@
1
  import { Routes } from '@angular/router';
2
 
3
- import { HomePage } from './home-page/home-page';
4
- import { booksPortalRoutes } from './books-portal/books-portal.routes';
5
- import { booksAdminRoutes } from './books-admin/books-admin.routes';
6
-
7
  export const routes: Routes = [
8
  { path: '', redirectTo: 'home', pathMatch: 'full' },
9
- { path: 'home', component: HomePage, title: 'BookMonkey' },
10
- ...booksPortalRoutes,
11
- ...booksAdminRoutes
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  ];
 
1
  import { Routes } from '@angular/router';
2
 
 
 
 
 
3
  export const routes: Routes = [
4
  { path: '', redirectTo: 'home', pathMatch: 'full' },
5
+ {
6
+ path: 'home',
7
+ title: 'BookMonkey',
8
+ loadComponent: () => import('./home-page/home-page')
9
+ .then(m => m.HomePage)
10
+ },
11
+ {
12
+ path: 'books',
13
+ loadChildren: () => import('./books-portal/books-portal.routes')
14
+ .then(m => m.booksPortalRoutes)
15
+ },
16
+ {
17
+ path: 'admin',
18
+ loadChildren: () => import('./books-admin/books-admin.routes')
19
+ .then(m => m.booksAdminRoutes)
20
+ }
21
  ];
src/app/books-admin/books-admin.routes.ts CHANGED
@@ -3,6 +3,6 @@ import { Routes } from '@angular/router';
3
  import { BookCreatePage } from './book-create-page/book-create-page';
4
 
5
  export const booksAdminRoutes: Routes = [
6
- { path: 'admin', redirectTo: 'admin/create' },
7
- { path: 'admin/create', component: BookCreatePage, title: 'Create Book' }
8
  ];
 
3
  import { BookCreatePage } from './book-create-page/book-create-page';
4
 
5
  export const booksAdminRoutes: Routes = [
6
+ { path: '', redirectTo: 'create', pathMatch: 'full' },
7
+ { path: 'create', component: BookCreatePage, title: 'Create Book' }
8
  ];
src/app/books-portal/books-portal.routes.ts CHANGED
@@ -4,6 +4,6 @@ import { BooksOverviewPage } from './books-overview-page/books-overview-page';
4
  import { BookDetailsPage } from './book-details-page/book-details-page';
5
 
6
  export const booksPortalRoutes: Routes = [
7
- { path: 'books', component: BooksOverviewPage, title: 'Books' },
8
- { path: 'books/details/:isbn', component: BookDetailsPage, title: 'Book Details' },
9
  ];
 
4
  import { BookDetailsPage } from './book-details-page/book-details-page';
5
 
6
  export const booksPortalRoutes: Routes = [
7
+ { path: '', component: BooksOverviewPage, title: 'Books' },
8
+ { path: 'details/:isbn', component: BookDetailsPage, title: 'Book Details' },
9
  ];