Senior
18 novembre 2026Trouve le bug : Angular
Un extrait de code. Trouve le bug, ou prouve qu'il n'y en a pas.
typescript
1import { Directive, inject, DestroyRef } from '@angular/core';
2import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3import { Observable } from 'rxjs';
4
5@Directive()
6export abstract class BaseListComponent<T> {
7 protected readonly destroyRef = inject(DestroyRef);
8
9 protected abstract load(): Observable<T[]>;
10
11 protected items: T[] = [];
12
13 protected refresh() {
14 this.load()
15 .pipe(takeUntilDestroyed(this.destroyRef))
16 .subscribe((data) => (this.items = data));
17 }
18}
19Clique sur les lignes qui posent problème.
Ton verdict
Une tentative par jour. La réponse s'affiche juste après.
Garde ta série
Crée un compte pour conserver ta série et suivre ta progression.