Master Angular's revolutionary signal system with 40+ real-world examples covering signals, linked signals, resource API, and defer blocks
Angular Signals Modern reactive state management |
Performance Defer blocks & optimization |
- π What You'll Learn
- β‘ Quick Start
- π― Examples - Signals
- π Examples - LinkedSignal
- π‘ Examples - Resource API
- β³ Examples - Defer Block
- π οΈ Development
- π€ Contributing
- π License
π₯ 16 comprehensive examples showcasing Angular's reactive signal system from basics to advanced patterns
π Beginner Examples (1-8)
# | Example | Description | Live Demo |
---|---|---|---|
1 | Count Increment/Decrement | Basic signal operations | π Demo |
2 | Auto Increment Count | Automatic signal updates | π Demo |
3 | Update Name Using Input | Input binding with signals | π Demo |
4 | Computed Signals | Derived state management | π Demo |
5 | Todo List | CRUD operations with signals | π Demo |
6 | Input with ngModel | Two-way data binding | π Demo |
7 | Observable to Signal | Migration from RxJS | π Demo |
8 | Signal with Side Effects | Effect management | π Demo |
π¨ Advanced Examples (9-16)
# | Example | Description | Live Demo |
---|---|---|---|
9 | Simple VAT Calculator | Business logic with signals | π Demo |
10 | Product Search | Real-time filtering | π Demo |
11 | Input Signals | Component input patterns | π Demo |
12 | Untracked Signal | Performance optimization | π Demo |
13 | Shopping Cart | Complex state management | π Demo |
14 | Virtual Scroll | Performance with large datasets | π Demo |
15 | Loading Spinner | UI state management | π Demo |
16 | Read Only Signals | Immutable state patterns | π Demo |
π 3 powerful examples demonstrating Angular's LinkedSignal for reactive computed state
# | Example | Description | Key Features | Live Demo |
---|---|---|---|---|
1 | Default Course Quantity | Basic linked signal implementation | β’ Default values β’ Reactive updates |
π Demo |
2 | Total Price Calculator | Dynamic price calculations | β’ Mathematical operations β’ Real-time computation |
π Demo |
3 | Dynamic Pricing Engine | Advanced pricing based on user & product | β’ Complex business logic β’ Multi-factor calculations |
π Demo |
4 | Unit Converter (Celsius β Fahrenheit) | Two-way unit conversion with linkedSignal | β’ Bi-directional binding β’ Real-world scenario |
π Demo |
π 6 comprehensive examples showcasing Angular's new Resource API for data fetching
# | Example | API Type | Description | Live Demo |
---|---|---|---|---|
1 | Basic Fetch | resource() |
Simple data fetching patterns | π Demo |
2 | List Resources | rxResource() |
Working with RxJS streams | π Demo |
3 | HTTP Resource | httpResource() |
HTTP client integration | π Demo |
4 | Random User API | resource() |
Real-world API integration | π Demo |
5 | GitHub Repositories | rxResource() |
Complex data transformations | π Demo |
6 | Random Jokes | httpResource() |
Error handling & retry logic | π Demo |
β‘ 11 performance-focused examples showcasing Angular's defer blocks for lazy loading optimization
Angular's defer blocks provide declarative lazy loading for better performance by deferring the loading of parts of your template until specific conditions are met.
# | Example | Trigger Type | Description | Live Demo |
---|---|---|---|---|
1 | Defer on Idle | @idle |
Loads when browser becomes idle | π Demo |
2 | Defer on Interaction | @interaction |
Triggers on user interaction | π Demo |
3 | Defer on Viewport | @viewport |
Loads when entering viewport | π Demo |
4 | Defer with Timer | @timer |
Time-based loading | π Demo |
6 | Defer on Hover | @hover |
Mouse hover triggers | π Demo |
7 | Defer on Immediate | @immediate |
Immediate after render | π Demo |
# | Example | Advanced Features | Description | Live Demo |
---|---|---|---|---|
5 | Advanced Defer | Multiple triggers + Error handling | Complex condition management | π Demo |
8 | Multiple Triggers & Prefetch | Performance optimization | Smart prefetching strategies | π Demo |
9 | Error Handling & Retry | Robust error management | Retry mechanisms & fallbacks | π Demo |
10 | Loading States with Timing | Professional UX | Anti-flicker timing controls | π Demo |
11 | Real-world Dashboard | Production-ready | Complete dashboard widget | π Demo |
Requirement | Version | Description |
---|---|---|
Node.js | v20+ | JavaScript runtime |
Angular CLI | v20+ | Angular development toolkit |
TypeScript | v5.0+ | Type-safe JavaScript |
Knowledge | Basic | Angular & TypeScript fundamentals |
# Development server
npm run start # Start dev server (http://localhost:4200)
# Building
npm run build # Production build
npm run build:dev # Development build
# Testing
npm run test # Unit tests
npm run e2e # End-to-end tests
# Code quality
npm run lint # ESLint
npm run format # Prettier
π Detailed Development Guide
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The application will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice.
We welcome contributions! Here's how you can help:
Issues Report bugs or suggest features |
Pull Requests Submit code improvements |
Documentation Improve examples & guides |
Examples Add new signal patterns |
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is released into the Public Domain. You can use it anywhere, for any purpose, without any restrictions whatsoever.
No rights reserved. Feel free to:
- β Use commercially
- β Modify freely
- β Distribute without attribution
- β Create derivative works
- β Use in proprietary software
This is educational content meant to help the Angular community learn and grow! π
If this project helped you, please consider giving it a β!
Made with β€οΈ by Sonu Sindhu