mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
feat(notfound): add NotFound page (#1672)
This commit is contained in:
parent
0ba99f2c6b
commit
fa3cdf731b
9 changed files with 120 additions and 0 deletions
25
src/app/pages/miscellaneous/miscellaneous-routing.module.ts
Normal file
25
src/app/pages/miscellaneous/miscellaneous-routing.module.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { MiscellaneousComponent } from './miscellaneous.component';
|
||||||
|
import { NotFoundComponent } from './not-found/not-found.component';
|
||||||
|
|
||||||
|
const routes: Routes = [{
|
||||||
|
path: '',
|
||||||
|
component: MiscellaneousComponent,
|
||||||
|
children: [{
|
||||||
|
path: '404',
|
||||||
|
component: NotFoundComponent,
|
||||||
|
}],
|
||||||
|
}];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class MiscellaneousRoutingModule { }
|
||||||
|
|
||||||
|
export const routedComponents = [
|
||||||
|
MiscellaneousComponent,
|
||||||
|
NotFoundComponent,
|
||||||
|
];
|
||||||
10
src/app/pages/miscellaneous/miscellaneous.component.ts
Normal file
10
src/app/pages/miscellaneous/miscellaneous.component.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ngx-miscellaneous',
|
||||||
|
template: `
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
export class MiscellaneousComponent {
|
||||||
|
}
|
||||||
14
src/app/pages/miscellaneous/miscellaneous.module.ts
Normal file
14
src/app/pages/miscellaneous/miscellaneous.module.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ThemeModule } from '../../@theme/theme.module';
|
||||||
|
import { MiscellaneousRoutingModule, routedComponents } from './miscellaneous-routing.module';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
ThemeModule,
|
||||||
|
MiscellaneousRoutingModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
...routedComponents,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class MiscellaneousModule { }
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<nb-card>
|
||||||
|
<nb-card-body>
|
||||||
|
<div class="flex-centered col-xl-4 col-lg-6 col-md-8 col-sm-12">
|
||||||
|
<h2 class="title">404 Page Not Found</h2>
|
||||||
|
<small class="sub-title">The page you were looking for doesn't exist</small>
|
||||||
|
<button (click)="goToHome()" type="button" class="btn btn-block btn-hero-primary">
|
||||||
|
Take me home
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</nb-card-body>
|
||||||
|
</nb-card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
.flex-centered {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
nb-card-body {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-title {
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
17
src/app/pages/miscellaneous/not-found/not-found.component.ts
Normal file
17
src/app/pages/miscellaneous/not-found/not-found.component.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { NbMenuService } from '@nebular/theme';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ngx-not-found',
|
||||||
|
styleUrls: ['./not-found.component.scss'],
|
||||||
|
templateUrl: './not-found.component.html',
|
||||||
|
})
|
||||||
|
export class NotFoundComponent {
|
||||||
|
|
||||||
|
constructor(private menuService: NbMenuService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
goToHome() {
|
||||||
|
this.menuService.navigateHome();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -141,6 +141,16 @@ export const MENU_ITEMS: NbMenuItem[] = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Miscellaneous',
|
||||||
|
icon: 'nb-shuffle',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: '404',
|
||||||
|
link: '/pages/miscellaneous/404',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Auth',
|
title: 'Auth',
|
||||||
icon: 'nb-locked',
|
icon: 'nb-locked',
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { PagesComponent } from './pages.component';
|
import { PagesComponent } from './pages.component';
|
||||||
import { DashboardComponent } from './dashboard/dashboard.component';
|
import { DashboardComponent } from './dashboard/dashboard.component';
|
||||||
|
import { NotFoundComponent } from './miscellaneous/not-found/not-found.component';
|
||||||
|
|
||||||
const routes: Routes = [{
|
const routes: Routes = [{
|
||||||
path: '',
|
path: '',
|
||||||
|
|
@ -31,10 +32,16 @@ const routes: Routes = [{
|
||||||
}, {
|
}, {
|
||||||
path: 'tables',
|
path: 'tables',
|
||||||
loadChildren: './tables/tables.module#TablesModule',
|
loadChildren: './tables/tables.module#TablesModule',
|
||||||
|
}, {
|
||||||
|
path: 'miscellaneous',
|
||||||
|
loadChildren: './miscellaneous/miscellaneous.module#MiscellaneousModule',
|
||||||
}, {
|
}, {
|
||||||
path: '',
|
path: '',
|
||||||
redirectTo: 'dashboard',
|
redirectTo: 'dashboard',
|
||||||
pathMatch: 'full',
|
pathMatch: 'full',
|
||||||
|
}, {
|
||||||
|
path: '**',
|
||||||
|
component: NotFoundComponent,
|
||||||
}],
|
}],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { PagesComponent } from './pages.component';
|
||||||
import { DashboardModule } from './dashboard/dashboard.module';
|
import { DashboardModule } from './dashboard/dashboard.module';
|
||||||
import { PagesRoutingModule } from './pages-routing.module';
|
import { PagesRoutingModule } from './pages-routing.module';
|
||||||
import { ThemeModule } from '../@theme/theme.module';
|
import { ThemeModule } from '../@theme/theme.module';
|
||||||
|
import { MiscellaneousModule } from './miscellaneous/miscellaneous.module';
|
||||||
|
|
||||||
const PAGES_COMPONENTS = [
|
const PAGES_COMPONENTS = [
|
||||||
PagesComponent,
|
PagesComponent,
|
||||||
|
|
@ -14,6 +15,7 @@ const PAGES_COMPONENTS = [
|
||||||
PagesRoutingModule,
|
PagesRoutingModule,
|
||||||
ThemeModule,
|
ThemeModule,
|
||||||
DashboardModule,
|
DashboardModule,
|
||||||
|
MiscellaneousModule,
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
...PAGES_COMPONENTS,
|
...PAGES_COMPONENTS,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue