Q. What does the @HostListener decorator do in Angular?

  • (A) Binds a method to a DOM event of the host element
  • (B) Listens to changes in child components
  • (C) Handles HTTP requests
  • (D) Creates a new component
πŸ’¬ Discuss
βœ… Correct Answer: (A) Binds a method to a DOM event of the host element
Explanation: @HostListener listens to events on the host element and triggers the decorated method.
Explanation by: Mr. Dubey
@HostListener listens to events on the host element and triggers the decorated method.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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