Senior
November 18, 2026Spot the bug: Angular
One snippet. Find the bug, or prove there isn't one.
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}
19Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.