Q. How can you inject a service into a component?

  • (A) By adding it to the component constructor parameters
  • (B) By importing the service file
  • (C) By using @Injectable decorator in the component
  • (D) By using @Component decorator
πŸ’¬ Discuss
βœ… Correct Answer: (A) By adding it to the component constructor parameters
Explanation: Services are injected via constructor parameters and Angular DI system.
Explanation by: Mr. Dubey
Services are injected via constructor parameters and Angular DI system.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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