404 wildcard for subpaths

This commit is contained in:
Cagatay Civici 2022-10-27 21:27:36 +03:00
parent 73c7e63414
commit 1f7ef417fc
6 changed files with 11 additions and 7 deletions

View File

@ -19,8 +19,8 @@ import { AppLayoutComponent } from "./layout/app.layout.component";
}, },
{ path: 'auth', loadChildren: () => import('./demo/components/auth/auth.module').then(m => m.AuthModule) }, { path: 'auth', loadChildren: () => import('./demo/components/auth/auth.module').then(m => m.AuthModule) },
{ path: 'landing', loadChildren: () => import('./demo/components/landing/landing.module').then(m => m.LandingModule) }, { path: 'landing', loadChildren: () => import('./demo/components/landing/landing.module').then(m => m.LandingModule) },
{ path: 'pages/notfound', component: NotfoundComponent }, { path: 'notfound', component: NotfoundComponent },
{ path: '**', redirectTo: 'pages/notfound' }, { path: '**', redirectTo: '/notfound' },
], { scrollPositionRestoration: 'enabled', anchorScrolling: 'enabled', onSameUrlNavigation: 'reload' }) ], { scrollPositionRestoration: 'enabled', anchorScrolling: 'enabled', onSameUrlNavigation: 'reload' })
], ],
exports: [RouterModule] exports: [RouterModule]

View File

@ -5,7 +5,8 @@ import { RouterModule } from '@angular/router';
imports: [RouterModule.forChild([ imports: [RouterModule.forChild([
{ path: 'error', loadChildren: () => import('./error/error.module').then(m => m.ErrorModule) }, { path: 'error', loadChildren: () => import('./error/error.module').then(m => m.ErrorModule) },
{ path: 'access', loadChildren: () => import('./access/access.module').then(m => m.AccessModule) }, { path: 'access', loadChildren: () => import('./access/access.module').then(m => m.AccessModule) },
{ path: 'login', loadChildren: () => import('./login/login.module').then(m => m.LoginModule) } { path: 'login', loadChildren: () => import('./login/login.module').then(m => m.LoginModule) },
{ path: '**', redirectTo: '/notfound' }
])], ])],
exports: [RouterModule] exports: [RouterModule]
}) })

View File

@ -5,7 +5,8 @@ import { RouterModule } from '@angular/router';
imports: [RouterModule.forChild([ imports: [RouterModule.forChild([
{ path: 'crud', loadChildren: () => import('./crud/crud.module').then(m => m.CrudModule) }, { path: 'crud', loadChildren: () => import('./crud/crud.module').then(m => m.CrudModule) },
{ path: 'empty', loadChildren: () => import('./empty/emptydemo.module').then(m => m.EmptyDemoModule) }, { path: 'empty', loadChildren: () => import('./empty/emptydemo.module').then(m => m.EmptyDemoModule) },
{ path: 'timeline', loadChildren: () => import('./timeline/timelinedemo.module').then(m => m.TimelineDemoModule) } { path: 'timeline', loadChildren: () => import('./timeline/timelinedemo.module').then(m => m.TimelineDemoModule) },
{ path: '**', redirectTo: '/notfound' }
])], ])],
exports: [RouterModule] exports: [RouterModule]
}) })

View File

@ -18,7 +18,8 @@ import { RouterModule } from '@angular/router';
{ path: 'panel', data: { breadcrumb: 'Panel' }, loadChildren: () => import('./panels/panelsdemo.module').then(m => m.PanelsDemoModule) }, { path: 'panel', data: { breadcrumb: 'Panel' }, loadChildren: () => import('./panels/panelsdemo.module').then(m => m.PanelsDemoModule) },
{ path: 'table', data: { breadcrumb: 'Table' }, loadChildren: () => import('./table/tabledemo.module').then(m => m.TableDemoModule) }, { path: 'table', data: { breadcrumb: 'Table' }, loadChildren: () => import('./table/tabledemo.module').then(m => m.TableDemoModule) },
{ path: 'tree', data: { breadcrumb: 'Tree' }, loadChildren: () => import('./tree/treedemo.module').then(m => m.TreeDemoModule) }, { path: 'tree', data: { breadcrumb: 'Tree' }, loadChildren: () => import('./tree/treedemo.module').then(m => m.TreeDemoModule) },
{ path: 'menu', data: { breadcrumb: 'Menu' }, loadChildren: () => import('./menus/menus.module').then(m => m.MenusModule) } { path: 'menu', data: { breadcrumb: 'Menu' }, loadChildren: () => import('./menus/menus.module').then(m => m.MenusModule) },
{ path: '**', redirectTo: '/notfound' }
])], ])],
exports: [RouterModule] exports: [RouterModule]
}) })

View File

@ -4,7 +4,8 @@ import { IconsComponent } from './icons/icons.component';
@NgModule({ @NgModule({
imports: [RouterModule.forChild([ imports: [RouterModule.forChild([
{ path: 'icons', data: { breadcrumb: 'Prime Icons' }, component: IconsComponent } { path: 'icons', data: { breadcrumb: 'Prime Icons' }, component: IconsComponent },
{ path: '**', redirectTo: '/notfound' }
])], ])],
exports: [RouterModule] exports: [RouterModule]
}) })

View File

@ -98,7 +98,7 @@ export class AppMenuComponent implements OnInit {
{ {
label: 'Not Found', label: 'Not Found',
icon: 'pi pi-fw pi-exclamation-circle', icon: 'pi pi-fw pi-exclamation-circle',
routerLink: ['/pages/notfound'] routerLink: ['/notfound']
}, },
{ {
label: 'Empty', label: 'Empty',