Modern Angular Course 16: Creating a Cart Service @loianegroner
Modern Angular Course 16: Creating a Cart Service  @loianegroner
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
Modern Angular Course 16: Creating a Cart ServiceSpring AI + Angular: Clone ChatGPTEstrutura de Dados com Java | Lista Encadeada | 06: Buscar por Elemento ou Posição na ListaCRUD Angular + Spring | 46: Curso-Aulas: Listando AulasCurso de Java #97: Formatando Números: DecimalFormatCurso Angular #149: Deploy em Produção com ng deploy (Firebase)Curso Angular #129: Http: Editando Cursos e Observables aninhadosEstrutura de Dados e Algoritmos com Java: Filas: Exer 01 Impressão de DocumentosEstrutura de Dados com Java | Lista Encadeada | 04: Percorrer a ListaCurso Angular #125: Erro Http: Alerta de Erro com BootstrapCRUD Angular + Spring | 57: Validando Enums com Java Bean ValidationsCurso Angular #121: Http: Dica: Variável de Ambiente
Loiane Groner |

Modern Angular Course 16: Creating a Cart Service

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER