What Is Feature Modules?
What Are the Types of Feature Modules?
The feature modules are modules that goal of organizing an application code. It also helps you partition the app into focused areas when you can do everything within the root module.
There are five types of feature modules which are the following-
1. Domain Feature Modules
2. Routed Feature Modules
3. Routing Modules
4. Service Feature Modules
5. Widget Feature Modules
Routed Feature Module - Routed feature modules are domain feature modules that components targets of router navigation routes.
A lazy-loaded routed feature module should not be imported by any module.
Routed feature modules do not export anything because their components never appear in the template of an external component.
Routing Module - A routing module provides routing configuration for another module and the routing module focus on the following.
1. Defines Routes
2. Adds Router Configuration to the module's imports
3. Adds service providers to the module's providers
4. A routing module doesn’t have its own declarations. The components, directives, and pipes are the responsibility of the feature module and not the routing module.
A routing module should only be imported by its companion module.
Service Feature Module - Service modules provide utility services and used to communicate with the server. The HttpClientModule is a great example of a service module.
The root AppModule is the single module that should import service modules.
Domain Feature Module - Domain feature modules deliver a user experience dedicated to a special application domain as like editing a customer and so on.
Widget Feature Module - A widget module makes components, directives, and pipes available to external modules.
The third party UI components and libraries are widget modules.