πŸ“Š Angular
Q. What will happen if you add a service in the providers array of a component?
  • (A) The service will be singleton app-wide
  • (B) A new instance will be created for that component and its children
  • (C) The service will be globally available
  • (D) It will throw an error
πŸ’¬ Discuss
βœ… Correct Answer: (B) A new instance will be created for that component and its children

Explanation: Component-level providers create a new instance scoped to that component subtree.

Explanation by: Mr. Dubey
Component-level providers create a new instance scoped to that component subtree.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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