Using Angular Router
In Everyday Market, let's implement the following routes:
/products: This is the default route that displays the product's listing homepage./products/new: This displays the form to create a new product./products/:id: This displays product details for the specified productid. The fact that theidis prefixed with a colon instructs Angular Router to treat it as a parameter and match it with the URL.
These routes are illustrated in the following diagram:

Using Angular Router, let's implement client-side routing with the following steps:
- Create the components to be used in the new
routeswith the following command:
ng generate component modules/market/product-view-page ng generate component modules/market/product-edit-page
- Define the market
routesconfiguration inmarket.module.tsas follows:- Import
RouterModuleandRoutesfrom the@angular/routerpackage. - Create a
routesconfiguration object. - Import
RouterModuleas part ofMarketModule. - You can remove the exported
ProductsPageComponent...
- Import