Routing Angular Applications

Not Found Pages

To create a not found page, we'll be using the wildcard catchall that the router provides.

We can add the route after creating our new NotFoundComponent. In app.routing.ts, we'll add:

const appRoutes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'about', component: AboutComponent },
  { path: 'contact', component: ContactComponent },
  { path: '**', component: NotFoundComponent }

Like this article? Follow @chrisoncode on Twitter