In order to define and implement the navigation strategy, we will make use of router and RouterModule.
We need to update our app.module.ts file to do the following:
- Import RouterModule and routes from Angular router module
- Import the application components
- Define the routes with path and component details
- Import RouterModule.forRoot (appRoutes)
Each route definition can have the following keys:
- path: The URL we want to display in the browser address bar.
- component: Corresponding component that will hold the view and application logic.
- redirectTo (optional): This indicates the URL we want the user to get redirected from this path.
- pathMatch (optional): A redirect route requires pathMatch--it tells the router how to match a URL to the path of a route. pathMatch can take either value as full or prefix.
We will now import and configure the...