Thursday, January 9, 2020

How to iterate over the list in lightning web components

How to iterate over list in lightning web components

This blog post will explain "How to iterate over list in lightning web components".


        <table class="slds-table slds-table_cell-buffer slds-table_bordered">
              <tr class="slds-line-height_reset">
                <th class="" scope="col">
                  <div class="slds-truncate" title="Key">Account Name</div>
                <th class="" scope="col">
                  <div class="slds-truncate" title="Value">Account Description</div>
            <template for:each={} for:item="item" for:index="index">
                <tr key={}>
                    <th scope="col">
                    <th scope="col">


/* eslint-disable no-unused-vars */
/* eslint-disable no-alert */
/* eslint-disable no-console */
/* eslint-disable guard-for-in */

/* eslint-disable vars-on-top */

import { LightningElement, track, wire } from 'lwc';

import getDataFromApex from '@salesforce/apex/listapexcontroller.methodName';

export default class listdemolwc extends LightningElement {

@wire(getDataFromApex) accountsdata;



public with sharing class listapexcontroller {
    public static list<Account> methodName(){

        list<Account> acclist=new list<Account>();
        acclist=[SELECT id,Name,Description from Account];
        return acclist;
    public listapexcontroller() {


<aura:application extends="force:slds">

No comments:

Post a Comment