Safe value must use [property]=binding after bypass security with DomSanitizer

前端 未结 5 1153
我寻月下人不归
我寻月下人不归 2020-12-05 13:18



        
5条回答
  •  不知归路
    2020-12-05 13:37

    As the error message says, the sanitized HTML needs to be added using property binding:

    constructor(private domSanitizer:DomSanitizer) {
      this.massTimingsHtml = this.getInnerHTMLValue();
    }
    getInnerHTMLValue(){
      return this.domSanitizer.bypassSecurityTrustHtml(this.parishDetail.mass_timings);
    }
    

    StackBlitz example (based on Swapnil Patwa's Plunker - see comments below)

提交回复
热议问题