シニア
2026年11月18日バグを見つけろ:Angular
コードは1つ。バグを見つけるか、バグがないことを示してください。
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}
19問題のある行をクリックしてください。
あなたの判断
1日1回まで。回答するとすぐに正解が表示されます。
連続記録を守る
アカウントを作成すると連続記録を保存し、進捗を追跡できます。