Routing configuration can be defined based on different strategies depending upon the complexity of the application. If this is a small application, route definitions can be defined either in root module such as AppModule
(app.module.ts
) or another routing module (such as app-routing.module.ts
) at the root level which is later imported in AppModule
. If it is a complex or an enterprise app having several features and each of those features has- its route definitions, it is recommended to define routing at feature module level.
In this section, we will learn about some of the following techniques for routing:
- Routing within
AppModule
- Routing as a separate module at the app root level
- Routing within feature modules