Question · Angular course · Module 5: Services and DI
Review: recommended injection
You are creating a new standalone component in Angular 19 and want to inject the CartService. What do you choose?
Answer options
- The inject(CartService) function
- The @Inject decorator in a class field
- Directly importing the service instance
- The global variable window.cartService
You can check the correct answer by solving this task in the CodeWorlds game.