미들
2026년 10월 4일버그를 찾아라: Angular
코드 한 조각. 버그를 찾거나, 버그가 없음을 증명하세요.
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}문제가 되는 줄을 클릭하세요.
당신의 판단
하루 한 번. 제출하면 바로 정답이 표시됩니다.
연속 기록 유지하기
계정을 만들면 연속 기록을 유지하고 진행 상황을 추적할 수 있습니다.