Question · Angular course · Module 2: Components
ngOnDestroy
Which lifecycle hook is used to clean up resources (unsubscribing, clearing timers) before the component is destroyed?
Answer options
- ngOnInit
- ngOnChanges
- ngAfterViewInit
- ngOnDestroy
Show the answer
Correct answer:
- ngOnDestroy