Course lesson
Set up an Angular Signal Effect Cleanup Handler
Sometimes you will need to properly clean up your effects to prevent memory leaks. Like if you use timeouts or intervals.
- Duration
- 3 min
- Access
- Free
- Transcript
- Retained from source evidence
Sometimes you will need to properly clean up your effects to prevent memory leaks. Like if you use timeouts or intervals.
Implement cleanup logic using the onCleanup callback. In your effect you can call onCleanup, pass it a callback, and define actions like clearing intervals or unsubscribing from observables when effects are no longer needed.