Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/@theme/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './search-input/search-input.component';
export * from './tiny-mce/tiny-mce.component';
export * from './theme-settings/theme-settings.component';
export * from './theme-switcher/theme-switcher.component';
export * from './page-not-found/page-not-found.component';
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NbMenuService } from '@nebular/theme';
import { Component } from '@angular/core';

@Component({
selector: 'ngx-page-not-found',
styleUrls: ['./page-not-found.component.scss'],
templateUrl: './page-not-found.component.html',
})
export class PageNotFoundComponent {

constructor(private menuService: NbMenuService) {
}

goToHome() {
this.menuService.navigateHome();
}
}
2 changes: 2 additions & 0 deletions src/app/@theme/theme.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
ThemeSettingsComponent,
ThemeSwitcherComponent,
TinyMCEComponent,
PageNotFoundComponent,
} from './components';
import { CapitalizePipe, PluralPipe, RoundPipe, TimingPipe } from './pipes';
import {
Expand Down Expand Up @@ -65,6 +66,7 @@ const COMPONENTS = [
SearchInputComponent,
ThemeSettingsComponent,
TinyMCEComponent,
PageNotFoundComponent,
OneColumnLayoutComponent,
SampleLayoutComponent,
ThreeColumnsLayoutComponent,
Expand Down
4 changes: 4 additions & 0 deletions src/app/pages/pages-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';

import { PagesComponent } from './pages.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { PageNotFoundComponent } from '../@theme/components';

const routes: Routes = [{
path: '',
Expand Down Expand Up @@ -35,6 +36,9 @@ const routes: Routes = [{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full',
}, {
path: '**',
component: PageNotFoundComponent,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, let's name it NotFoundComponent as the other pages don't have a Page prefix.

}],
}];

Expand Down