Routes and Routers
A single-page application (SPA) is one in which the user originally receives only one index.html
page and, from there, all the content of the web application is rendered using JavaScript.
From the user’s perspective, however, they are interacting with the application on different interfaces (or pages) such as the login screen, the home page, and the purchase form. Technically, they are all rendered on the index.html
page but, for the user, they are different experiences.
The mechanism responsible for this flow of interfaces that the client interacts with in a SPA is the routing engine. The Angular framework has this feature out of the box and, in this chapter, we will explore it in detail.
We will cover the following topics in this chapter:
- Routes and navigation
- Defining an error page and title
- Dynamic routes – wildcards and parameters
- Securing routes – guards
- Optimizing the experience – Resolve