2
我有一個管道解碼html代碼。例如<p>test</p>
成爲test
Primeng Datatable內的角度2管道給出安全錯誤
當我使用它的列裏面,它不顯示數據,但 'SafeValue must use [property]=binding: XXXX (see http://g.co/ng/security#xss)
'
DATATABLE
<p-dataTable [value]="toShowSubVragen">
<!-- WITH Pipe, DOESN'T WORK
SHOWS: SafeValue must use [property]=binding: XXXX (see http://g.co/ng/security#xss)-->
<p-column field="tekst" header="With Pipe">
<template let-col let-vraag="rowData" pTemplate="body">
<span>{{vraag[col.field] | safeHtml}}</span>
</template>
</p-column>
<!-- WITHOUT Pipe, WORKS
SHOWS: the tekst data.. -->
<p-column field="tekst" header="Without Pipe">
<template let-col let-car="rowData" pTemplate="body">
<span>{{car[col.field]}}</span>
</template>
</p-column>
</p-dataTable>
管
@Pipe({ name: 'safeHtml'})
export class SafeHtmlPipe implements PipeTransform {
constructor(private sanitized: DomSanitizer) {}
transform(value) {
return this.sanitized.bypassSecurityTrustHtml(value);
}
}
我該如何解決這個問題?
@君特Zöchbauer'SafeValue'它不是來自我的數據。我想從管道的類 –