Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
oguzhan18 avatar

Angular Destroyref

  • 180 installs
  • 6 repo stars
  • Updated April 4, 2026
  • oguzhan18/angular-ecosystem-skills

Register teardown callbacks with DestroyRef to unsubscribe observables, clear timers, and prevent memory leaks in Angular components.

About

Angular-destroyref skill guides proper DestroyRef usage for automatic cleanup of subscriptions, intervals, and DOM listeners in standalone components, reducing memory leaks and aligning with current Angular lifecycle APIs in production apps.

  • DestroyRef injection pattern
  • onDestroy callback registration
  • Observable unsubscribe cleanup
  • Timer and listener teardown
  • Modern Angular lifecycle API

Angular Destroyref by the numbers

  • 180 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #893 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oguzhan18/angular-ecosystem-skills --skill angular-destroyref

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs180
repo stars6
Last updatedApril 4, 2026
Repositoryoguzhan18/angular-ecosystem-skills

What it does

Register teardown callbacks with DestroyRef to unsubscribe observables, clear timers, and prevent memory leaks in Angular components.

Files

SKILL.mdMarkdownGitHub ↗

Angular DestroyRef

Version: Angular 16+ (2025) Tags: DestroyRef, Cleanup, takeUntilDestroyed

References: DestroyRef

Best Practices

  • Use takeUntilDestroyed
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

@Component({})
export class MyComponent {
  private destroyRef = inject(DestroyRef);
  
  ngOnInit() {
    this.data$.pipe(
      takeUntilDestroyed(this.destroyRef)
    ).subscribe();
  }
}
  • Use in service
@Injectable({ providedIn: 'root' })
export class DataService {
  private destroyRef = inject(DestroyRef);
  
  getData() {
    return this.http.get('/api/data').pipe(
      takeUntilDestroyed(this.destroyRef)
    );
  }
}

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.