In this article I'll explain you how to handling 404 error
Serve project
Change in app routing
Starting a new project
First use your terminal to navigate to a directory that will be the parent directory of your project, then run this command:
ng new app-name
Serve project
ng serve
Add a 404 page
ng g component notfound
Change in app routing
import { NotfoundComponent } from './notfound/notfound.component';
const routes: Routes = [
{ path: '**', component: NotfoundComponent },
]
Change in notfound.component.html
<h1>404</h1>
No comments:
Post a Comment