4 min read
•Question 45 of 46mediumDestroyRef
Cleanup without ngOnDestroy.
What is DestroyRef?
DestroyRef provides a way to register cleanup callbacks without implementing ngOnDestroy. Works with inject().
Benefits
- No interface implementation
- Works with functional patterns
- Can be injected anywhere