Having routing in your application means you want to navigate between different topics in your navigation. You usually use a top menu or left menu and press on links to get where you want. This causes the URL in the browser to change. In a Single-Page Application (SPA), this doesn't cause a page reload. To get set up with the Angular router is quite easy, but there are some things we need in place for it to be considered set up:
- Specify a base element in index.html
- Import the RouterModule and tell the root module about it
- Set up a routing dictionary
- Decide on where to place the viewport of your application, that is, decide where in the page your content should be placed
- Interact with a routing service if you want to investigate things such as routing or query parameters, or if you need to programmatically route the user to another page in your application