app-routing.module.ts 1.4 KB

123456789101112131415161718192021222324252627282930
  1. import { CanDeactivateGuard } from './shared/can-deactivate-guards.service';
  2. import { NgModule } from '@angular/core';
  3. import { Routes, RouterModule, PreloadAllModules } from '@angular/router';
  4. import { LoginComponent } from './login/login.component';
  5. import { RegesterComponent } from './regester/regester.component';
  6. import { PageNotFoundComponent } from './page-not-found/page-not-found.component';
  7. import { AuthGuardService as AuthGuard } from './shared/auth-guard.service';
  8. import { ServicesComponent } from './servicesItems/services.component';
  9. const routes: Routes = [
  10. {path: '', redirectTo: '/ExternalPage/home', pathMatch: 'full'},
  11. {path: 'login', component: LoginComponent},
  12. {path: 'signup', component: RegesterComponent},
  13. {path: 'services/:id', component: ServicesComponent, canActivate: [AuthGuard]},
  14. {path: 'service/:userID/:serviceID', loadChildren: './dashboard/dashboard.module#DashBoardModule', canLoad: [AuthGuard]},
  15. {path: 'InternalPage' , loadChildren: './Internal-Page/internal-page.module#InternalPageModule'},
  16. {path: 'ExternalPage', loadChildren: './External-Page/external-page.module#ExternalPageModule'},
  17. {path: 'profile/:idProfile', component: RegesterComponent, canActivate: [AuthGuard]},
  18. {path: 'page-not-found', component: PageNotFoundComponent},
  19. {path: '**', redirectTo: '/page-not-found', pathMatch: 'full'}
  20. ];
  21. @NgModule({
  22. imports: [RouterModule.forRoot(routes)],
  23. exports: [RouterModule]
  24. })
  25. export class AppRoutingModule { }