Router life cycle
This lesson will look at the life cycle of a router.
We'll cover the following...
Let’s look at the working of an Angular Router. The very first and foremost task of an Angular Router is to navigate to the configured routes for the components which are routable. So the components of a route are configured as the route configurations and these configurations are known as Router states. Once these states are configured, the Angular router will render this set of components and bring the change in the browser URL. This will also require the router outlet to be present on the template, as a placeholder for placing the template view on that page.
And this is why the first step when working with Angular routing is to import the RouterModule inside your application. The next step is to configure the router states that form a tree of the router states. To do this, the routes are configured inside the routermodule.forRoot()
method.
In the next lesson, on setting up a routing application, you will see the different ways of using routermodule.forRoot()
. ...