[SalesForce] attribute or String new line in var object

enter image description here

hello im currently express this var with

 var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  \r\n  " + " 2. Payment Condition : Cash only Conditions may Apply. \r\n " + "3. Period : may changed after customer's deal.";
    var action = component.get("c.getInitData");

Best Answer

<aura:unescapedHTML> tag should be used here. And instead of \r\n, use HTML tag <br/> for line breaks.

https://developer.salesforce.com/docs/component-library/bundle/aura:unescapedHtml/specification

 var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  <br/> 2. Payment Condition : Cash only Conditions may Apply. <br/> 3. Period : may changed after customer's deal.";
component.set("v.auraAttributeVar",consultRemark);

<aura:unescapedHtml value="{!v.auraAttributeVar}" />

To put new lines in Lightning:inputRichText, replace <br/> with <p/>

var consultRemark = "1. Valid Date : 1 Week , Based on Quote Date  <p/> 2. Payment Condition : Cash only Conditions may Apply. <p/> 3. Period : may changed after customer's deal.";
    component.set("v.auraAttributeVar",consultRemark);

<lightning:inputRichText value="{!v.auraAttributeVar}" placeholder="Type something interesting"/>
Related Topic