πŸ“Š Angular
Q. How do you declare a service so it's available application-wide?
  • (A) Use @Injectable({ providedIn: 'root' })
  • (B) Add it to component's providers
  • (C) Use global keyword
  • (D) Declare in main.ts
πŸ’¬ Discuss
βœ… Correct Answer: (A) Use @Injectable({ providedIn: 'root' })

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

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

πŸ’¬ Discussion


πŸ“Š Question Analytics

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