Understanding and adding routes
As previously stated, the Angular CLI automatically configured routing when creating our project, so all we need to do now is specify the routes to the components of our application that we previously created.
Not all components are routable – in other words, they should be mapped to particular paths. For example, the header component will be included in other components to render the header element of the page through its selector, therefore we do not need to include it in our routing module's routes
array.
A route is a Route
object that holds information about which component maps to which path. A path is a URL element that specifies which view should be navigated to.
A route may have one or more of the following attributes:
path
: A property that holds the route's path.pathMatch
: A property for configuring the matching strategy that the router will use to match the path. It can have aprefix
or afull
value, with...