Angular 2, DomSanitizer, bypassSecurityTrustHtml, SVG

后端 未结 3 542
情深已故
情深已故 2020-11-27 19:01

I\'ve been using DomSanitizer with an SVG in an html string.

Previous to the current version of Angular, this worked just fine:

this.domSanitizer.bypas

3条回答
  •  渐次进展
    2020-11-27 19:39

    This can also be done via object bracket notation:

    let safeHtml = this.domSanitizer.bypassSecurityTrustHtml(content);
    console.log(safeHtml["changingThisBreaksApplicationSecurity");
    

    Had to do this because safeHtml.changingThisBreaksApplicationSecurity didn't work for me.

提交回复
热议问题