1

This question already has an answer here:

In a lightning component I display some text dynamically, from the field "Description" of a customized object "Article__c". So when in salesforce I fill the Description field, it appears in my component.

The problem is when, in Salesforce, I put a line break in the Description fiels, in my component I see "<br>"

Is there any way to fix that ?

In the developper console I saw that <br> is not approved, it has to be <br/> but salsforce automatically create the <br> tag...

here is a bit of my code:

<aura:component controller="ActuliteImageController" implements="forceCommunity:availableForAllPageTypes">

<aura:attribute name="art" type="Article__c[]"/>

<div class="conteneur">
<aura:iteration var="a" items="{!v.art}">
    <div class="article">
        <div class="texte">{!a.Name} : <aura:unescapedHtml value="{!a.Description__c}"/></div>
        <p><img src="{!'/servlet/servlet.FileDownload?file=' + a.image.Id}" /></p>
    </div>
</aura:iteration>
</div>

</aura:component>

marked as duplicate by Vamsi Krishna, Himanshu, Sergej Utko, Ratan Paul, Adrian Larson Mar 14 '16 at 15:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • the answer <aura:unescapedHtml value="{!v.note.body}"/> could have worked, but not... I still see the tag <br>, or I don't put the code at the right place... – dou Mar 14 '16 at 10:39
  • if you can share your current code, that will help some one to answer you. – Vamsi Krishna Mar 14 '16 at 10:39
  • I edited my question with the aura:unescapedHtml at the right place, and it's working, if it can help someone... – dou Mar 14 '16 at 11:02