Confirmé
4 octobre 2026

Trouve le bug : Angular

Un extrait de code. Trouve le bug, ou prouve qu'il n'y en a pas.

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}

Clique sur les lignes qui posent problème.

Ton verdict

Une tentative par jour. La réponse s'affiche juste après.

Garde ta série

Crée un compte pour conserver ta série et suivre ta progression.

Créer un compte