• Shalini Soni 6
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Its seem that you have to go around the barn every which way I turn with SF LWC!  I am trying to do a simple condition check but I don't want to check true to a boolean value such as below.  I want to check a data records field value to a hard-coded value in the HTML file.

<template if:true={mydata.data}>

I want to check the value of the of the data to a hardcoded value like...

<template for:each={mydata.data} for:item="d">
     <div key={d.Message__c}>
         <div if:m.Message_Style__c = "Success">
             <strong>{m.Message__c}</strong>
         </div>
     </div>
</template>


I tried...

<div if:true={m.Message_Style__c} = "Success">

and

<div if:true={m.Message_Style__c} == "Success">

and other variations with no luck.

Just seem like there is so much lacking capability to easily do conditional markup in LWC.  I am really new to LWC and not much on javascript or HTML so that could be some of my issue! :)

What I want to do is have the data on a record control the color theme.  So if a user picks from the picklist "Info" it will use the slds-theme_info, or if the record has "Success" selected in the picklist then the data is displayed using the slds-theme_sucess.

Thanks for your help.