Organizing Modules by Type
Explore how to organize Angular applications by grouping modules according to their type and loading strategy. Understand the roles of core and shared modules and how eager and lazy loading impact app performance. This lesson helps you structure modules for scalability and reuse using Angular's built-in features.
We'll cover the following...
Angular modules are used to group similar functionalities and provide them to other modules. They can be further organized by the type of functionality and how an Angular application loads them. We can separate modules according to the feature that they represent:
Core module: This usually contains application-wide artifacts that do not fit in a specific module. Such artifacts are components that are loaded once in an application, such as a top bar that contains the main menu of the application, a footer component with copyright information, or a loading spinner. It also contains services that can be shared among modules, such as a local cache service or a custom logger. This module is usually called core, and the accompanying TypeScript file is named
core.module.ts. The core module should be loaded only once in the main application module.Shared module: ...