Handling Unknown Route Paths

Learn how to handle unknown routes by setting up a default route and create a wildcard route in Angular.

We came across the concept of unknown routes. We set up a wildcard route to display PageNotFoundComponent when our application tries to navigate to a route path that does not exist. Now, it is time to add that component for real:

  1. Use the generate command of the Angular CLI to create a new component named page-not-found:

Note: The command below is for creating a new component locally using the Angular CLI.

Get hands-on with 1400+ tech skills courses.