πŸ“Š Angular
Q. How do you create a service singleton throughout the entire Angular application?
  • (A) Provide it in root injector using providedIn: 'root'
  • (B) Declare it in component providers
  • (C) Use @Singleton decorator
  • (D) Declare it in NgModule's declarations
πŸ’¬ Discuss
βœ… Correct Answer: (A) Provide it in root injector using providedIn: 'root'

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

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

πŸ’¬ Discussion


πŸ“Š Question Analytics

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