ミドル
2026年10月4日

バグを見つけろ:Angular

コードは1つ。バグを見つけるか、バグがないことを示してください。

typescript
1import { Component } from '@angular/core';
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
4@Component({
5  selector: 'app-comment',
6  template: '<div [innerHTML]="safeComment"></div>'
7})
8export class CommentComponent {
9  safeComment: SafeHtml = '';
10  userComment = '';
11
12  constructor(private sanitizer: DomSanitizer) {}
13
14  displayComment(input: string) {
15    this.userComment = input;
16    this.safeComment = this.sanitizer.bypassSecurityTrustHtml(input);
17  }
18}

問題のある行をクリックしてください。

あなたの判断

1日1回まで。回答するとすぐに正解が表示されます。

連続記録を守る

アカウントを作成すると連続記録を保存し、進捗を追跡できます。

アカウントを作成