How to Unescaping HTML in Lightning Component

by Rijwan Mohmmed

We can unescap the html by using this aura:unescapedHtml . This component is used to write the html content as it is without performing recalculation. Like we show our code in Blog without compile. Lets get more with a simple example.

Lightning Component :

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="htmlstring" type="String" default=""/>
    <div class="slds-m-around--xx-large">
        With Render <aura:unescapedHtml value="{!v.htmlstring}"/>.
	<div class="slds-m-around--xx-large">
        Without Render <span>{!v.htmlstring}</span>.

Lightning Controller :

	doInit : function(component, event, helper) {
		component.set("v.htmlstring", "<h1>Hello World!!</h1>");

You may also like


Jennie November 10, 2021 - 3:56 am

I am sure this paragraph has touched all
the internet viewers, its really really pleasant article on building up
new web site.

Ronda November 11, 2021 - 5:24 pm

That is really fascinating, You’re an overly skilled blogger.I have joined your rss feed and sit up for searchingfor extra of your great
post. Additionally, I have shared your site in my social networks


Leave a Comment