A

Admin • 825.56K Points
Coach

Q. How do you define a service as a singleton in Angular?

  • (A) Provide it in the root injector
  • (B) Use the providedIn: 'any'
  • (C) Create a new instance in each component
  • (D) Use the Injectable() without providers
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category Angular JS
  • Hashtags:

Explanation by: Admin
To make a service singleton, use `@Injectable({ providedIn: 'root' })`.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.