A

Admin • 833K Points
Coach

Q. How do you provide a service at the root level in Angular?

  • (A) Using @Injectable({providedIn: 'root'})
  • (B) Adding service to AppModule providers
  • (C) Declaring service inside a component
  • (D) Providing service in child modules
  • Correct Answer - Option(A)
  • Views: 28
  • Filed under category Angular JS
  • Hashtags:

Explanation by: Admin

This makes the service a singleton and available app-wide.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.