πŸ“Š Angular
Q. Which lifecycle hook is used to clean up subscriptions and detach event handlers before a component is destroyed?
  • (A) ngOnDestroy
  • (B) ngOnInit
  • (C) ngAfterViewInit
  • (D) ngDoCheck
πŸ’¬ Discuss
βœ… Correct Answer: (A) ngOnDestroy

Explanation: ngOnDestroy is called just before the component is destroyed to perform cleanup.

Explanation by: Mr. Dubey
ngOnDestroy is called just before the component is destroyed to perform cleanup.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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