πŸ“Š Angular
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
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using @Injectable({providedIn: 'root'})

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

Explanation by: Mr. Dubey
This makes the service a singleton and available app-wide.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
44
Total Visits
πŸ“½οΈ
8 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
80%
Success Rate