This project demonstrates how to use Angular's traditional module-based architecture with non-standalone components. It specifically focuses on the @NgModule decorator and its metadata properties (declarations, imports, exports, providers, bootstrap). There is also a simple documentary blog post about this repo. You can read it here; https://medium.com/p/ce71fc1dc9b9
The application is a simple guide to Middle-earth realms from The Lord of the Rings, organized into "Good Side" (Rivendell, Gondor, Rohan) and "Bad Side" (Mordor) sections. Each realm has its own page with information and interactive elements. The project structure showcases how to organize code using Angular's module system.
- @NgModule Metadata Focus: Explores the declarations, imports, exports, providers, and bootstrap properties
- Modular Architecture: Uses Angular's traditional NgModule system instead of the newer standalone components
- Feature Modules: Separate modules for good and bad realms
- Shared Components: Reusable components across different feature modules
- Custom Pipes: Demonstrates how to create and use pipes in a modular architecture
This project focuses specifically on the @NgModule decorator and its metadata properties:
- declarations: Components, directives, and pipes that belong to this module
- imports: Other modules whose exported components/directives/pipes are needed
- exports: Components, directives, and pipes that can be used in other modules
- providers: Services that the module contributes to the global collection of services
- bootstrap: The main application view (root component)
- AppModule: The root module that bootstraps the application
- GoodSidePagesModule: Contains components for the good realms
- BadSidePagesModule: Contains components for the bad realms
- ComponentsModule: Contains shared components used across the application
- PipesModule: Contains custom pipes used across the application
While Angular is moving towards standalone components, understanding the traditional module-based architecture is still important for:
- Maintaining existing Angular applications
- Working with enterprise applications that haven't migrated to standalone components
- Understanding Angular's dependency injection system at a deeper level
- Learning how Angular organizes and manages components, directives, and pipes
- Clone the repository
- Run
npm installto install dependencies - Run
ng serveto start the development server - Navigate to
http://localhost:4200/
src/
├── app/
│ ├── components/ # Shared components
│ │ └── character-display/ # Component for displaying character info
│ ├── pages/ # Feature pages
│ │ ├── good-side-pages.module.ts
│ │ ├── bad-side-pages.module.ts
│ │ ├── gondor/
│ │ ├── mordor/
│ │ ├── rivendell/
│ │ └── rohan/
│ ├── pipes/ # Custom pipes
│ │ └── character-info.pipe.ts
│ ├── app.component.ts # Root component
│ ├── app.module.ts # Root module
│ └── app-routing.module.ts # Application routes
└── ...
If you want to learn more about Angular's module system and decorators, check out:
This project is licensed under the MIT License - see the LICENSE file for details.