Safe value must use [property]=binding

gypjoy · 2020-01-10

如错误消息所述,需要使用属性绑定添加经过清理的HTML:

<p [innerHTML]="massTimingsHtml"></p>
constructor(private domSanitizer:DomSanitizer) {
  this.massTimingsHtml = this.getInnerHTMLValue();
}
getInnerHTMLValue(){
  return this.domSanitizer.bypassSecurityTrustHtml(this.parishDetail.mass_timings);
}

全栈工程师

770 浏览
0