0

I have a Lightning-formatted-text tag in place which displays error from JS and apex controller. Now I want this error to be displayed along with error icon on the component. Below is the HTML code:

 <lightning-formatted-text icon-name="utility:error" class="slds-text-color_error" value={warningMessage}></lightning-formatted-text>

Now when the error occurs on the component, I am getting error message, but not error icon. When I use Lightning-icon tag, the error icon is displaying even before the error message is displayed. Like it is staying on the page all the time.

Can anyone help me out here

1 Answer 1

1

lightning-formatted-text doesn't have an icon-name attribute.

You can display the icon separately, and only when there's an error, like this:

<lightning-icon icon-name="utility:error" if:true={warningMessage}>
</lightning-icon>
1
  • This worked..Thanks :)
    – Kirshna
    Jun 9, 2020 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.