Put in order · Angular course · Module 5: Services and DI
Data lifecycle in the cart service
Order the sequence of operations on a signals-based cart service:
Items to put in order
- private items = signal<CartItem[]>([])
- clearCart() - this.items.set([])
- addItem() - this.items.update(...)
- totalPrice = computed(() => ...)
You can check the correct answer by solving this task in the CodeWorlds game.