Answers for "for:each in lwc js"

0

for:each in lwc js

<template>
    <lightning-card title="Account List using for:each" icon-name="custom:custom63">
        <div class="slds-m-around_medium">
            <template if:true={accounts.data}>
                <template for:each={accounts.data} for:item="acc">
                    <p key={acc.Id}>{acc.Name}</p>
                </template>
            </template>
            <template if:true={accounts.error}>
                {accounts.error}
            </template>
        </div>
    </lightning-card>
</template>
Posted by: Guest on January-11-2021
0

for:each in lwc js

<template for:each={lstAccounts} for:item="acc">
    <p key={acc.Id} style="display:inline">
        <lightning-badge label={acc.Name}></lightning-badge>
    </p>
</template>
Posted by: Guest on January-10-2021
0

for:each in lwc js

import { LightningElement, wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class AccountListForEachLWC extends LightningElement {
    @wire(getAccountList) accounts;
}
Posted by: Guest on January-11-2021
0

for:each in lwc js

public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account];
    }
}
Posted by: Guest on January-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language