Wildcard Routes
Learn what wildcard routes are and how we can use them to handle invalid URLs within our application.
What are the wildcard routes?
Another important part of defining Routes in our application is setting up wildcard routes.
Wildcard routes are how we tell Angular how to handle invalid URLs and what to do with them.
An invalid URL could be where the user mistypes the name of a path.
Example: Navigating an invalid route
For example, we know that http://localhost:4200/clients
is a valid path in our Client Contact Manager application, but http://localhost:4200/client
isn’t because we don’t have a route in our Routes
array that matches that exact /client
route. If the user was to add that into the browser’s address bar, our application would throw an error saying that this path is not recognized. ...