Use <aura:unescapedHtml /> component to unescape the HTML in Lightning Component.
Example
Lightning Component
aura:unescapedHtml
Example
Lightning Component
<aura:component implements="flexipage:availableForAllPageTypes">
<aura:attribute name="strURL" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:card>
<p class="slds-m-around--xx-large">
<h2>Welcome to my <aura:unescapedHtml value="{!v.strURL}"/></h2>
</p>
</lightning:card>
</aura:component>
JS Controller({
doInit : function(component, event, helper) {
let strURL = '<a href="https://www.salesforcecodecrack.com/" target="_blank">Salesforce Code Crack</a> Blog.';
component.set('v.strURL', strURL);
}
})
Resourceaura:unescapedHtml
can we use lightning:formattedRichText tag instead of aura:unescapedHtml
ReplyDelete