Put in order · Angular course · Module 5: Services and DI
Injecting a shared service
Order the construction of a component that uses the shared CartService:
Items to put in order
- private cartService = inject(CartService);
- export class ProductComponent {
- import { CartService } from './cart.service';
- import { inject } from '@angular/core';
You can check the correct answer by solving this task in the CodeWorlds game.