app-routing.module.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { NgModule } from "@angular/core";
  2. import { CommonModule } from "@angular/common";
  3. import { BrowserModule } from "@angular/platform-browser";
  4. import { Routes, RouterModule } from "@angular/router";
  5. import { AdminModule } from "./layouts/admin/admin.module";
  6. import { AdminComponent } from "./layouts/admin/admin.component";
  7. import { LoginComponent } from "./components/login/login.component";
  8. import { AuthGuard } from "./services/auth.guard";
  9. import { Role } from "./models/role";
  10. import { WorkflowGuard } from "./services/investment-proposal-workflow.guard";
  11. const routes: Routes = [
  12. {
  13. path: "",
  14. // redirectTo: "dashboard",
  15. redirectTo: "investment-proposals",
  16. pathMatch: "full"
  17. },
  18. {
  19. path: "",
  20. component: AdminComponent,
  21. canActivate: [AuthGuard],
  22. children: [
  23. {
  24. path: "",
  25. loadChildren: "./layouts/admin/admin.module#AdminModule" //() => AdminModule
  26. }
  27. ]
  28. },
  29. { path: "login", component: LoginComponent },
  30. { path: "**", redirectTo: "" }
  31. ];
  32. @NgModule({
  33. imports: [
  34. CommonModule,
  35. BrowserModule,
  36. RouterModule.forRoot(routes, {
  37. useHash: true
  38. //onSameUrlNavigation: "reload"
  39. })
  40. ],
  41. exports: []
  42. //providers: [WorkflowGuard]
  43. })
  44. export class AppRoutingModule {}