When using Dependency Injection in Angular, what is the significance of the @Injectable() decorator?

  • It creates a new instance of the service
  • It handles routing in Angular
  • It injects a service into a component
  • It marks a service as singleton
The @Injectable() decorator is used to mark a service as a singleton, meaning that Angular will create a single instance of the service and share it across components that request it.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *