@oguzhan18/angular-reactive

ALWAYS use when working with Angular Reactive programming, BehaviorSubject, Observable patterns, or reactive state management in Angular.

View in AI SkillSafe app
Scanned · no findings
0 downloads
0 stars
0 demos
SKILL.md
nameangular-reactive
descriptionALWAYS use when working with Angular Reactive programming, BehaviorSubject, Observable patterns, or reactive state management in Angular.

Angular Reactive Programming

Version: Angular 21 (2025) Tags: Reactive, Observables, RxJS, BehaviorSubject

References: Reactive GuideRxJS

Best Practices

  • Use BehaviorSubject for state
@Injectable({ providedIn: 'root' })
export class StateService {
  private state = new BehaviorSubject<State>(initialState);
  state$ = this.state.asObservable();
  
  updateState(newState: Partial<State>) {
    this.state.next({ ...this.state.value, ...newState });
  }
}
  • Use Observable in services
@Injectable({ providedIn: 'root' })
export class DataService {
  private http = inject(HttpClient);
  
  getData(): Observable<Data[]> {
    return this.http.get<Data[]>('/api/data');
  }
}
  • Use async pipe
@Component({
  template: `
    @if (data$ | async; as data) {
      {{ data.name }}
    }
  `
})
export class MyComponent {
  data$ = this.service.getData();
}
  • Use shareReplay for caching
data$ = this.http.get('/api/data').pipe(
  shareReplay(1)
);
  • Use takeUntil for cleanup
@Component({})
export class MyComponent implements OnDestroy {
  private destroy$ = new Subject<void>();
  
  ngOnInit() {
    this.data$.pipe(takeUntil(this.destroy$)).subscribe();
  }
  
  ngOnDestroy() {
    this.destroy$.next();
    this.destroy$.complete();
  }
}

Embed badges

Add these to your README to show the skill's verification status.

SkillSafe verified badge
Verified badge
[![SkillSafe verified badge](https://api.skillsafe.ai/v1/badge/@oguzhan18/angular-reactive/verified)](https://skillsafe.ai/skill/@oguzhan18/angular-reactive/)
Installs badge
Installs badge
[![Installs badge](https://api.skillsafe.ai/v1/badge/@oguzhan18/angular-reactive/installs)](https://skillsafe.ai/skill/@oguzhan18/angular-reactive/)
Scan badge
Scan badge
[![Scan badge](https://api.skillsafe.ai/v1/badge/@oguzhan18/angular-reactive/scan)](https://skillsafe.ai/skill/@oguzhan18/angular-reactive/)
Eval pass rate badge
Eval pass rate
[![Eval pass rate badge](https://api.skillsafe.ai/v1/badge/@oguzhan18/angular-reactive/eval)](https://skillsafe.ai/skill/@oguzhan18/angular-reactive/)