Dashboard as First Page
How to set Dashboard as First page instead landing
This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.
AuthGuard is removed from routes to avoid login checks
Update route at: src/app/app-routing.module.ts
src/app/app-routing.module.ts
// angular import
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
// project import
import { AdminLayout } from './theme/layout/admin-layout/admin-layout.component';
import { GuestLayouts } from './theme/layout/guest-layout/guest-layout.component';
// import { AuthGuardChild } from './theme/shared/components/_helpers/auth.guard';
import { SimpleLayouts } from './theme/layout/simple-layout/simple-layout.component';
//type
import { Role } from './theme/shared/components/_helpers/role';
const routes: Routes = [
{
path: '',
component: AdminComponent,
// canActivateChild: [AuthGuardChild],
children: [
{
path: '',
redirectTo: '/dashboard/default',
pathMatch: 'full'
},
{
path: '',
loadComponent: () => import('./demo/dashboard/default/default.component').then((c) => c.DefaultComponent),
data: { roles: [Role.Admin, Role.User] }
},
{
path: 'default',
loadComponent: () => import('./demo/dashboard/default/default.component').then((c) => c.DefaultComponent),
data: { roles: [Role.Admin, Role.User] }
},
...
]
...
...
},
{
path: '',
component: GuestComponent,
children: [
...
{
path: 'auth',
// canActivateChild: [AuthGuardChild],
loadChildren: () => import('./demo/pages/authentication/authentication.module').then((m) => m.AuthenticationModule),
data: {
roles: [Role.Admin, Role.User]
}
},
{
path: 'maintenance',
// canActivateChild: [AuthGuardChild],
loadChildren: () => import('./demo/pages/maintenance/maintenance.module').then((m) => m.MaintenanceModule),
data: {
roles: [Role.Admin, Role.User]
}
...
]
},
{
path: '',
component: SimpleLayouts,
children: [
{
path: 'components',
loadChildren: () => import('./theme/layout/simple-layout/com-navigation/com-navigation.module').then((m) => m.ComNavigationModule)
},
{
path: 'contact-us',
// canActivateChild: [AuthGuardChild],
loadComponent: () => import('./demo/pages/contact-us/contact-us.component').then((c) => c.ContactUsComponent)
}
]
},
]
Last updated