Which lifecycle hook is used to clean up subscriptions?

  1. ngOnInit
  2. ngAfterViewInit
  3. ngOnDestroy
  4. ngDoCheck
Correct answer ngOnDestroy

Explanation

ngOnDestroy is used to clean up resources like subscriptions.

Update: Admin added a tag on this question

Topics

By Admin · · 24 views