diff --git a/src/app/pages/questions/components/question/question.component.html b/src/app/pages/questions/components/question/question.component.html index 1e1db8c01..6ffd6d2a8 100755 --- a/src/app/pages/questions/components/question/question.component.html +++ b/src/app/pages/questions/components/question/question.component.html @@ -5,16 +5,14 @@ [class.content-matrix]="isMatrix" >
-

{{ question.section_header }}

+

-

- {{ question.field_label }} -

+

= new EventEmitter() + sanitizedSectionHeader = '' + sanitizedFieldLabel = '' value: any currentlyShown = false previouslyShown = false @@ -97,11 +101,12 @@ export class QuestionComponent implements OnInit, OnChanges { QuestionType.checkbox ]) - constructor() { + constructor(private sanitizer: DomSanitizer) { this.value = null } ngOnInit() { + this.updateSanitizedHtml() this.isScrollable = !this.NON_SCROLLABLE_SET.has(this.question.field_type) this.isFieldLabelHidden = this.HIDE_FIELD_LABEL_SET.has( this.question.field_type @@ -131,6 +136,15 @@ export class QuestionComponent implements OnInit, OnChanges { } } + private sanitizeHtml(value: string): string { + return this.sanitizer.sanitize(SecurityContext.HTML, value || '') || '' + } + + private updateSanitizedHtml() { + this.sanitizedSectionHeader = this.sanitizeHtml(this.question?.section_header) + this.sanitizedFieldLabel = this.sanitizeHtml(this.question?.field_label) + } + emitAnswer(event: any) { // Only proceed if event is not null or undefined if (event !== null && event !== undefined) {