Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ##app.routing.ts
  2. const routes: Routes = [
  3.   { path: '', component: HomeComponent },
  4.   { path: 'login', loadChildren: 'src/app/Authorization/Authorization.module#AuthorizationModule' },
  5.   { path: 'homepage', loadChildren: 'src/app/Flats/Flats.module#FlatsModule' },
  6.   { path: 'notices', loadChildren: 'src/app/Notice/Notices.module#NoticesModule' },
  7.   { path: 'fees', loadChildren: 'src/app/fees/Fees.module#FeesModule' },
  8.  
  9. ];
  10.  
  11. export const ModuleRouting: ModuleWithProviders = RouterModule.forRoot(routes);
  12.  
  13. ##app.module.ts
  14.   imports: [
  15.     ...
  16.     ...
  17.     ModuleRouting (z pliku app.routing.ts)
  18.   ]
  19.  
  20. ## I teraz dla każdego kolejnego modułu:
  21. ## moduł.routing.ts
  22. const routes: Routes = [
  23.   {
  24.     path: 'notices',
  25.     component: NoticeComponent,
  26.   }
  27. ];
  28. export const ModuleRouting: ModuleWithProviders = RouterModule.forChild(routes);
  29.  
  30. ## moduł.ts
  31. import { ModuleRouting } from './Notice.routing';
  32.  
  33. @NgModule({
  34.   imports: [
  35.     ...
  36.     ...
  37.     ModuleRouting
  38.   ],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement