In this section, we are going to see, how to dynamically import modules and other related components. In enterprise apps, there might be a scenario, where in you end up loading the modules based on some metadata, say which is coming from some REST call may be. In those scenarios, this kind of implementation is needed. We will discuss Lazy Loading in detail when we talk about those scenarios. However, let’s look at the code where we lazy load modules with all its dependencies.
In this section, we are going to continue from the last section and will get started with Child Routes aka Nested Routes. Nested routes is the concept of containing routes within other routes. With nested routes we’re able to encapsulate the functionality of parent routes and have that functionality apply to the child routes. This is one of the nice ways to isolate different functional areas. Otherwise, imagine your base routes will grow like anything. I have configured the routes in such a way that all reviews now sit under location. Below, I have pasted modified structure of app.