angular-destroyref

ALWAYS use when working with Angular DestroyRef, takeUntilDestroyed, or cleanup in Angular.

oguzhan18/angular-ecosystem-skills180 installsMITSynced Aug 26

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI

Agent Skills format with YAML frontmatter. Claude Code reads it as-is.

---
name: "angular-destroyref"
description: "ALWAYS use when working with Angular DestroyRef, takeUntilDestroyed, or cleanup in Angular."
license: "MIT"
---

# Angular DestroyRef

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

**References:** [DestroyRef](https://angular.io/api/core/DestroyRef)

## Best Practices

- Use takeUntilDestroyed

```ts
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

```ts
@Injectable({ providedIn: 'root' })
export class DataService {
  private destroyRef = inject(DestroyRef);
  
  getData() {
    return this.http.get('/api/data').pipe(
      takeUntilDestroyed(this.destroyRef)
    );
  }
}
```

More Frontend Frameworks skills

← All Frontend Frameworks skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY