Mid-Level
October 4, 2026

Spot the bug: Angular

One snippet. Find the bug, or prove there isn't one.

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}

Click 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.

Create an account