Uploaded May 2026 | Updated November 2026, 3 hours ago
In this video, we move from component-only state into shared application state as we enter Phase 2 of the Modern Angular course.
After wiring Add to Cart events with output() in the previous lesson, we now create a dedicated CartService so multiple parts of the app can read and update the same cart data.
In this video, you'll learn:
• Why shared cart state should live in a service instead of a component
• How to create a singleton service with providedIn: 'root'
• How to model cart state with a private signal
• How to update signal state immutably with update() and spread syntax
• How to inject CartService in ProductsGrid using inject()
• Why keeping business logic in services helps components stay focused
📦 Source code repository:
github.com/loiane/modern-angular
🎥 Full Modern Angular course playlist:
youtube.com/playlist?list=PLGxZ4Rq3BOBqJfR254ZMuBfFRMeyr162U
📌 This course is for:
• Developers new to Angular
• Developers upgrading from older Angular versions
🔔 Subscribe to follow the full Modern Angular course.
⏱️ Chapters
00:00 Why a Service?
02:10 Generate the CartService
03:52 Cart State with signal
04:41 addToCart with update
06:25 Injecting CartService in ProductsGrid
09:25 Quick Verification
10:11 What's Next
#ModernAngular #AngularCourse
In this video, we move from component-only state into shared application state as we enter Phase 2 of the Modern Angular course.
After wiring Add to Cart events with output() in the previous lesson, we now create a dedicated CartService so multiple parts of the app can read and update the same cart data.
In this video, you'll learn:
• Why shared cart state should live in a service instead of a component
• How to create a singleton service with providedIn: 'root'
• How to model cart state with a private signal
• How to update signal state immutably with update() and spread syntax
• How to inject CartService in ProductsGrid using inject()
• Why keeping business logic in services helps components stay focused
📦 Source code repository:
github.com/loiane/modern-angular
🎥 Full Modern Angular course playlist:
youtube.com/playlist?list=PLGxZ4Rq3BOBqJfR254ZMuBfFRMeyr162U
📌 This course is for:
• Developers new to Angular
• Developers upgrading from older Angular versions
🔔 Subscribe to follow the full Modern Angular course.
⏱️ Chapters
00:00 Why a Service?
02:10 Generate the CartService
03:52 Cart State with signal
04:41 addToCart with update
06:25 Injecting CartService in ProductsGrid
09:25 Quick Verification
10:11 What's Next
#ModernAngular #AngularCourse










