Dummy page not found component.
Installation
- A recommended way to install @4geit/ngx-page-not-found-component is through npm package manager using the following command:
npm i @4geit/ngx-page-not-found-component --save
Or use yarn
using the following command:
yarn add @4geit/ngx-page-not-found-component
- You need to import the
NgxPageNotFoundComponent
component within the module you want it to be. For instanceapp.module.ts
as follows:
import { NgxPageNotFoundComponent } from '@4geit/ngx-page-not-found-component';
And you also need to add the NgxPageNotFoundComponent
component with the @NgModule
decorator as part of the declarations
list.
@NgModule({
// ...
declarations: [
// ...
NgxPageNotFoundComponent,
// ...
],
// ...
})
export class AppModule { }
- You need to import the
NgxPageNotFoundComponent
component in the routing file you want to use it. For instanceapp-routing.module.ts
as follows:
import { NgxPageNotFoundComponent } from '@4geit/ngx-page-not-found-component';
And you also need to add the NgxPageNotFoundComponent
component within the list of routes
as follows:
const routes: Routes = [
// ...
{ path: '**', component: NgxPageNotFoundComponent }
// ...
];
Therefore if an non-existent route is requested the app will display the NgxPageNotFoundComponent
template.