From cedb6555819bbab2e6ddeca9b5792cf04b6967eb Mon Sep 17 00:00:00 2001 From: D3B1RUM4N <elies1.mek03@gmail.com> Date: Fri, 6 Dec 2024 04:12:50 +0100 Subject: [PATCH] fix: added function to decode --- .../multiple-choice/multiple-choice.component.ts | 10 ++++++++-- src/app/modules/home/play-quiz/play-quiz.component.ts | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/modules/home/play-quiz/multiple-choice/multiple-choice.component.ts b/src/app/modules/home/play-quiz/multiple-choice/multiple-choice.component.ts index b422e51..fda5bf4 100644 --- a/src/app/modules/home/play-quiz/multiple-choice/multiple-choice.component.ts +++ b/src/app/modules/home/play-quiz/multiple-choice/multiple-choice.component.ts @@ -10,7 +10,7 @@ export class MultipleChoiceComponent implements OnInit { @Input() getAnswer!: (id_tested_answer: number) => Promise<number>; good_answers: boolean[] = []; answer_click: number = -1; - constructor() {} + constructor() { } ngOnChanges(changes: SimpleChanges): void { if (changes['answers']) { @@ -19,7 +19,13 @@ export class MultipleChoiceComponent implements OnInit { } } - ngOnInit(): void {} + decodeHtml(html: string): string { + const textArea = document.createElement('textarea'); + textArea.innerHTML = html; + return textArea.value; + } + + ngOnInit(): void { } async handleClick(id_answer: number, position: number) { const right_answer = await this.getAnswer(id_answer); diff --git a/src/app/modules/home/play-quiz/play-quiz.component.ts b/src/app/modules/home/play-quiz/play-quiz.component.ts index b90f365..71067f0 100644 --- a/src/app/modules/home/play-quiz/play-quiz.component.ts +++ b/src/app/modules/home/play-quiz/play-quiz.component.ts @@ -37,6 +37,13 @@ export class PlayQuizComponent implements OnInit { }); } + decodeHtml(html: string): string { + const textArea = document.createElement('textarea'); + textArea.innerHTML = html; + return textArea.value; + } + + nextQuestion() { if (this.actualQuestionIndex === this.quiz.questionIndex - 1 + this.quiz.questions.length - 1) { Swal.fire({ -- GitLab