Linked Questions

7 votes
1 answer
38k views

Using arithmetic comparison in if:true statement in Lightning web component [duplicate]

I came to a situation where I want to render a text based on there index value. So, Let's assume I am having a loop which is having an index variable and I want to show some specific text if the index ...
Tarique Shamim's user avatar
1 vote
1 answer
5k views

Can we have ternary operator in DIV tag -- LWC [duplicate]

Can we write ternary operator in DIV tag on LWC as below. <div class = if:true= {showleftDiv} ? slds-size_4-of-6 : slds-size_4-of-6 >
SK2889's user avatar
  • 919
1 vote
1 answer
11k views

How to concatenate a value inside of the href property on lwc [duplicate]

I have the following code and I need to insert a '/' in my href property. <template for:each={assetData} for:item="item" for:index="indexvar"> <tr class="slds-hint-parent" key={item.Id}&...
Lucas Borim's user avatar
1 vote
2 answers
6k views

How to bind variable in inline style in LWC? [duplicate]

The code below shows binding of attribute in Lightning component. <div style="{!'width:' + v.padAtr + '%'}"> </div> Is there any way to do the same in LWC? In LWC, i tried the below code ...
Akshay_SFDC's user avatar
1 vote
2 answers
7k views

How to get dynamic string value within for:each loop of LWC template [duplicate]

I want to set style attribute value dynamically while looping in template. But LWC is warning me of this error message. LWC1060: Template expression doesn't allow CallExpression Below is my ...
tatsuya kanemoto's user avatar
0 votes
1 answer
9k views

How to pass Dynamic ID to href link in Lightning web components [duplicate]

I am trying to Preview and download document from LWC, From apex controller i am returning Map<> contains ID and Document name, and iteration that map data in html file and passing map.key value to ...
Rajesh P's user avatar
0 votes
1 answer
4k views

how to get the for"each value in get method in LWC javascript [duplicate]

<template for:each={listA} for:item="a"> <template for:each={listB} for:item="b"> <td data-id={a+b}> </td> </template> </...
Harry's user avatar
  • 3
1 vote
1 answer
473 views

How to do binary conditional rendering lightning web component [duplicate]

I have created a lightning web component to show several related object tables on a detailpage. Above one of the tables I want to show some extra specific data related to one of the object tables. We ...
Thomas's user avatar
  • 2,298
0 votes
1 answer
256 views

Lightning Web Components - Are there analogues to Angular Expressions? [duplicate]

I have just started using LWC recently having normally coded front-ends in Angular of some sort. There are a couple of things that you don't seem to be able to do with LWC that seem to be really ...
lemming's user avatar
  • 473
12 votes
2 answers
48k views

Set CSS class dynamically in Lightning web component

How would I translate that from Aura to LWC? <aura:iteration items="{!v.contacts}" var="contact"> <div class="{!contact.isActive ? 'slds-tabs--path dimmed' : 'slds-tabs--path'}">...<...
Robert Sösemann's user avatar
4 votes
2 answers
44k views

Issue with for:each Index in LWC

In LWC am trying to iterate over a list and show the details from the list, this is working correctly , but as a header want to show the record number in a displayed order, below is desired outcome ...
Rajasekhar's user avatar
  • 1,601
3 votes
3 answers
3k views

How to access the specific element from List<String> in HTML <template> file directly in LWC?

It is ok to retrieve the elements of a List<String> in Javascript controller in LWC as below: @wire(getListOfString)wrappers({error, data}) { if(data){ this.stringList = data; this....
Cray Kao's user avatar
  • 1,415
1 vote
1 answer
3k views

Render the table data based on each data condition in Lighting Web Component table

I am able to do the conditional rendering on visualforce page visualforce page: <table id="tblContact"> <thead> <tr> <td>Name</td> &...
Rival's user avatar
  • 601
2 votes
1 answer
2k views

Lighning Web Components : Passing Javascript string var to HTML href tag

I am trying to bind static url with parameters from Javascript and its not working. Tried several variants <lightning-tile label={option.label} href="https://www.google.com/search?q={option.label}"...
Ashraf's user avatar
  • 23
2 votes
1 answer
408 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

15 30 50 per page