1

I have html data in json format, when I click the button, data appears on the HTML page along with a warning message -

WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).

When I inspect it, I do not see contenteditable="true". How can I make this work?

Below is my code:

home.ts

  public json_html = {
    "button1":`<div class="content_text" contenteditable="true"><p>This is an editable paragraph.</p></div>`,
    "button2":"<p>second section</p>",
    "button3":"<p><b>third section<b></p>",
  }

 constructor(....)

this.buttons = Object.keys(this.json_html);

home.html

<button ion-button *ngFor="let button of buttons" (click)="selectedButton = button">
  {{ button }}
</button>


<div *ngIf="selectedButton" [innerHtml]="json_html[selectedButton]">
</div>
halfer
  • 19,824
  • 17
  • 99
  • 186
user2828442
  • 2,415
  • 7
  • 57
  • 105
  • 1
    Would you please check the below question: https://stackoverflow.com/questions/48487216/contenteditable-attribute-doesnt-work-when-element-added-via-innerhtml-in – Nour Jan 28 '18 at 14:26

0 Answers0