I have met an unexpected behavior for me of contenteditable
attribute in Angular. I have an object with HTML, stored as a value:
public json_html = {
"button1":"<p contenteditable='true'>first section</p>",
"button2":"<p>second section</p>",
"button3":"<p>third section</p>",
}
And I apply this values like this (via innerHTML
):
<div [innerHTML]="selectedButton"></div>
Everything works fine except contenteditable
attribute - it's just missed in HTML:
QUESTION:
How to force contenteditable
attribute to work (when element becomes through [innerHTML]
)? Is there a proper way to do that or may be there is a workaround?
LIVE EXAMPLE: https://stackblitz.com/edit/angular-9pyhg3-lnivvj?file=app%2Fbutton-overview-example.html