I am fetching below string from apex and I assign it to track property in jS and in HTML I add that track property inside div tag and instead of rendering it in formatted text it render as shown in below image.



String coming from apex

   <h2>Collection</h2><ol><li>0309Cab Calculated</li><li>01A2</li><li>00005</li><li>1 ALQ</li><li>000 New OU Analyte</li><li>% Viability (CPT)</li><li>% Cryocrit</li></ol>

enter image description here


1 Answer 1


Looks like the string from apex is html markup, more likely from Rich Text Area. You can use lightning-formatted-rich-text to maintain formatting.

 <lightning-formatted-rich-text value={stringFromApex}>

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .