I want to iterate over records and display those many number of lightning cards. Each row should have 2 cards using grid. I tried using for:each but it is only working on list. Below is my code:
<div class="slds-grid slds-gutters">
<div class="slds-col slds-size_1-of-2 slds-p-horizontal_large">
<template for:each={contacts} for:item="contact">
<li key={contact.Id} >
<lightning-card title="Hello">
<lightning-button label="Select" slot="actions"></lightning-button>
<p class="slds-p-horizontal_small">{contact.Name}, {contact.Title}</p>
<p class="slds-p-horizontal_small">50</p>
<p class="slds-p-horizontal_small">50</p>
</lightning-card>
</li>
</template>
</div>
</div>
I dont want to iterate over the list but the lightning card.
Best Answer
I have tried this and it works
HTML Code-
JS -
Here is the link for your reference - https://developer.salesforce.com/docs/component-library/tools/playground/9PQGPLDQ5/2/edit