Wire Adapters & Functions in LWC | DAY 6

Поділитися
Вставка
  • Опубліковано 1 жов 2024

КОМЕНТАРІ • 9

  • @PyrateGraphics
    @PyrateGraphics 8 місяців тому

    on the wired with function example you did not show how would you then resent the name on the front end. so on the 'accounts' property how would you display the returned name on the front end

    • @PriyankaBisht-f7o
      @PriyankaBisht-f7o 8 місяців тому +1

      It's the same way he did in previous example, using accounts variable in html

  • @sumanchakraborty6396
    @sumanchakraborty6396 Рік тому

    I am getting Object object in logs and not getting data visible in Component HTML, Could you please suggest what could went wrong below? Thanks
    JS-------------------
    import { getRecord } from 'lightning/uiRecordApi';
    import { LightningElement, api, wire } from 'lwc';
    import ACCOUNT_NAME_FIELD from '@salesforce/schema/Account.Name';
    export default class WireWithFunction extends LightningElement {
    @api
    recordId;
    accounts;
    error;
    @wire(getRecord, { recordId: '$recordId', fields: [ACCOUNT_NAME_FIELD] })
    wiredAccount({ error, data }) {
    if (data) {
    this.accounts = data;
    this.error = undefined;
    console.log(`##Getting Data from wire with function: ${this.accounts}`);
    }
    else if (error) {
    this.error = error;
    this.accounts = undefined;
    console.log("##Error Occured while fetching data: " + error.body.message);
    }
    }
    }
    HTML-----------------



    Account Name : {accounts.fields.Name.value}
    Account Number : {accounts.fields.AccountNumber.value}

  • @ramhardikgupta8351
    @ramhardikgupta8351 6 місяців тому +1

    Great

  • @MohamedRaoufZERROUK
    @MohamedRaoufZERROUK Рік тому +1

    Thank you

  • @nitinsen2939
    @nitinsen2939 Рік тому

    sir can you please share the PPT ?

    • @apexhours
      @apexhours  Рік тому +1

      Available on our blog post