πŸ“Š Angular
Q. How do you make an Angular service available to the entire application?
  • (A) Add 'providedIn: root' in the @Injectable decorator
  • (B) Add service in component's providers array
  • (C) Add service in a module's declarations
  • (D) Add service in app.component.html
πŸ’¬ Discuss
βœ… Correct Answer: (A) Add 'providedIn: root' in the @Injectable decorator

Explanation: This provides a singleton service application-wide via the root injector.

Explanation by: Mr. Dubey
This provides a singleton service application-wide via the root injector.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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