Skip to main content

Questions tagged [html-template-directives]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
2 answers
54 views

Using the <template> vs <div> for conditional rendering

The Salesforce documentation states that lwc:if tags can be used with or or really any HTML tags. Is there a significant difference in functionality between adding a <template> vs a <div>...
Yona Tran's user avatar
0 votes
1 answer
36 views

LWC Injecting HTML

I'm simply trying to use the lwc:inner-html example provided in the link below and can't get around the compile error: LWC1534: lwc:inner-html attribute is not supported. https://lwc.dev/guide/...
bernard's user avatar
2 votes
1 answer
580 views

dynamically constructing a URL in a LWC for:each section

I need the value attribute for a <lightning-formatted-url> in a for:each section of a LWC template to include the base url + a property from the current item, and I cannot figure out how this ...
gorav's user avatar
  • 4,537
1 vote
2 answers
2k views

lwc:if and lwc:else directive not working

child cmp html <template> <!--Edit Mode--> <template lwc:if={_isEditable}> <input type="number" step="1"></input> <button> {...
Gargi Gupta's user avatar
0 votes
2 answers
1k views

Why does my array not show up in the template for:each?

I am trying to get a value from a list of objects to show up on the html page using the for:each directive. I have a then method that dynamically builds an array of objects that holds an id number and ...
Benton's user avatar
  • 51
3 votes
1 answer
344 views

replacing visualforce conditional rendering formulas in LWC

so I'm migrating a visualforce component into LWC. In that component, there is a table rendered, and a lot of columns are rendered differently depending on data field values and/or some other ...
joacoiudica's user avatar
1 vote
2 answers
6k views

LWC Template if:true Directive not working

I'm trying to conditionally hide the lightning-tab,using if:true directive .The "courses" array is populated or empty using @wire adaptor.I am trying to use if:true condition to check if ...
borkya's user avatar
  • 11
1 vote
2 answers
3k views

LWC Get record field values and render DOM elements conditionally

I want to create a custom component for a record page that gets a field value for the record, determines if the value is null or not. If it is null, some content will be shown and some will be hidden. ...
Nathaniel's user avatar
0 votes
0 answers
7k views

input type="date" shows "dd-mm-yyyy" for empty value

let's say i have <div class="slds-form-element__control"> <input type="date" id="form-element-expiration-date" ...
pincet's user avatar
  • 919
1 vote
1 answer
445 views

Can I build a SPA using lightning web component framework outside Salesforce

I want to build a single page web app (not in Salesforce). Just like when we write html using Angular, you import JS and CSS (from Angular or react framework CDN). Similarly is it possible to do such ...
rajpc's user avatar
  • 49
4 votes
3 answers
31k views

Is it possible to use expressions in if:true or if:false tag in LWC?

I have 8 parameters to render the elements conditionally, Is it possible to use expressions in if:true statement? for example: <template if:true={p1.data || p2.data || p3.data}> <!-- some ...
Lanjinest's user avatar
  • 425
0 votes
1 answer
2k views

Is comparing two values possible in Html file of LWC?

I need to compare a list of pricebook IDs in a pricebookentries of a product with a list of PricebookIDs. Is it possible in HTML template? I'm attaching a image to get an idea of the table. Here PB1, ...
Santosh's user avatar
  • 73
1 vote
1 answer
3k views

LWC conditional display on load of component not working

Based on the field values of the Account, I want to display/hide parts of the component when it loads for the first time. I have tried so many things unsuccessfully and am hoping someone can help me ...
Irene's user avatar
  • 1,849
2 votes
2 answers
6k views

lwc looping till a certain number in html

In lwc for looping through data we have <template for:each={contacts} for:item="val"> </template> If i have a variable where in a number is stored, say for example 4. How do i run the ...
steamyfire's user avatar
0 votes
1 answer
6k views

Template marketing cloud: I would like to unlock full html, so that I can personnalize my template with class and tables

I used a marketing cloud template and I want to customize it with extra html (to make it render well on a specific email client). The thing is that when I click on code view > toggle 'show full ...
Catherine Martin's user avatar
12 votes
2 answers
30k views

appendChild to non empty div in lightning web component

I am using a thrid party library to render certain elements in a 'container', and as per the documentation on lwc directives, I understand that I have to add a directive to specificaly indicate that ...
glls's user avatar
  • 20.2k