Welcome to the Angular RxJS → Signals Migration Workshop! This comprehensive workshop will guide you through migrating a shopping cart implementation from RxJS patterns to Angular Signals.
This workshop is divided into three progressive levels:
- Basic Level: Traditional RxJS implementation with BehaviorSubjects and Observables
- Intermediate Level: Migration to Signals with computed values and effects
- Advanced Level: Advanced patterns using Resource API and performance optimization
Before starting the workshop, ensure you have the following installed:
- Node.js (version 18 or higher)
- npm (version 9 or higher)
- Angular CLI (version 18 or higher)
- A modern code editor (VS Code recommended)
- Angular DevTools browser extension (recommended)
-
Clone or download the project
cd shopping-cart-workshop -
Install dependencies
npm install
-
Start the development server
npm start
-
Open your browser Navigate to
http://localhost:4200 -
Install Angular DevTools (if not already installed)
- Chrome: Angular DevTools
- Firefox: Angular DevTools
shopping-cart-workshop/
├── src/
│ ├── app/
│ │ ├── basic/ # Level 1: RxJS Implementation
│ │ │ ├── services/
│ │ │ │ ├── shopping-cart-rxjs.service.ts # STARTER CODE
│ │ │ │ └── shopping-cart-signals.service.ts # SOLUTION
│ │ │ └── components/
│ │ ├── intermediate/ # Level 2: Signals + Computed
│ │ │ ├── services/
│ │ │ │ ├── cart-computed.service.ts # STARTER CODE
│ │ │ │ └── cart-effects.service.ts # ADDITIONAL FEATURES
│ │ │ └── components/
│ │ ├── advanced/ # Level 3: Resource API + Advanced
│ │ │ ├── services/
│ │ │ │ ├── product-resource.service.ts # STARTER CODE
│ │ │ │ └── advanced-cart.service.ts # SOLUTION
│ │ │ └── components/
│ │ └── shared/ # Shared models, components, utilities
│ ├── assets/
│ │ ├── data/
│ │ │ └── products.json # Mock product data
│ │ └── styles/ # CSS variables and components
│ └── environments/
├── tests/ # Comprehensive test suites
├── docs/ # Workshop documentation
└── package.json
Learning Objectives:
- Master RxJS BehaviorSubject and Observable patterns
- Implement reactive state management
- Handle asynchronous operations
- Create reactive UI components
Key Files:
src/app/basic/services/shopping-cart-rxjs.service.tssrc/app/basic/components/cart-basic.component.ts
Learning Objectives:
- Understand Angular Signals fundamentals
- Learn computed signals for derived state
- Implement effects for side effects
- Compare RxJS vs Signals patterns
Key Files:
src/app/intermediate/services/cart-computed.service.tssrc/app/intermediate/services/cart-effects.service.tssrc/app/intermediate/components/cart-intermediate.component.ts
Learning Objectives:
- Master the Resource API for data fetching
- Implement advanced signal patterns
- Optimize performance with fine-grained reactivity
- Build production-ready cart analytics
Key Files:
src/app/advanced/services/product-resource.service.tssrc/app/advanced/services/advanced-cart.service.tssrc/app/advanced/components/cart-advanced.component.ts
# Development
npm start # Start development server
npm run build # Build for production
npm run test # Run all tests
npm run lint # Lint the codebase
# Level-specific commands
npm run start:basic # Start basic level only
npm run start:intermediate # Start intermediate level only
npm run start:advanced # Start advanced level only
# Testing by level
npm run test:basic # Test basic level
npm run test:intermediate # Test intermediate level
npm run test:advanced # Test advanced levelThe workshop includes a navigation header that allows you to switch between levels:
- Basic Level (Green badge): RxJS implementation
- Intermediate Level (Orange badge): Signals + Computed
- Advanced Level (Red badge): Resource API + Advanced patterns
Each level is fully functional and can be explored independently.
- ✅ Add/remove products to/from cart
- ✅ Update item quantities
- ✅ Real-time price calculation with discounts
- ✅ Tax calculation (progressive rates)
- ✅ Shipping cost calculation
- ✅ Cart persistence (localStorage)
- ✅ Bulk operations and optimizations
- ✅ Product grid with search and filtering
- ✅ Category-based filtering
- ✅ Price range filtering
- ✅ Multiple sorting options
- ✅ Pagination support
- ✅ Product recommendations
- ✅ Cart analytics and metrics
- ✅ Session tracking
- ✅ Export/import functionality
- ✅ Undo/redo operations
- ✅ Performance monitoring
- ✅ Real-time sync simulation
Use Angular DevTools to inspect:
- Signal values and dependencies
- Component tree and change detection
- Performance profiler
- Dependency injection tree
Monitor in the Console:
- Cart state changes
- Performance metrics
- Local storage operations
- Network requests (in advanced level)
Issue: ng serve fails to start
Solution:
rm -rf node_modules package-lock.json
npm installIssue: Angular DevTools not showing signals Solution:
- Ensure you have Angular DevTools extension installed
- Refresh the page after opening DevTools
- Make sure you're using Angular 16+
Issue: Tests failing Solution:
# Run tests with more verbose output
npm run test -- --verbose
# Run specific test file
npm run test -- --include="**/basic/**"Issue: TypeScript compilation errors Solution:
- Ensure you're using TypeScript 5.4+
- Check that all imports are correct
- Verify that experimental signals are enabled
This workshop requires:
- Chrome 100+ (recommended for best DevTools experience)
- Firefox 100+
- Safari 15+
- Edge 100+
By the end of this workshop, you will:
- Understand the fundamental differences between RxJS and Signals
- Implement reactive state management using both approaches
- Migrate existing RxJS code to Signals systematically
- Optimize performance using fine-grained reactivity
- Build production-ready applications with modern Angular patterns
If you encounter issues during the workshop:
- Check the documentation in the
docs/folder - Review the test files for expected behavior
- Use Angular DevTools to inspect signal state
- Look at the solution files for reference
- Check the browser console for error messages
- Start with the Basic Level Instructions
- Complete the exercises in order
- Run tests to verify your implementation
- Review the solution code when ready
- Move to the next level
Good luck with your Angular Signals journey! 🚀