0

I am learning LWC by messing around with the standard trailhead exercises. I am trying to implement a modal functionality to one of the trailhead exercises. This is the code.

bearModal.html

<template>
<lightning-modal-header label="View Bear"></lightning-modal-header>
<lightning-modal-body>
    <p>{recordId}</p>
    <lightning-record-form
      layout-type="compact"
      object-api-name="Bear__c"
      record-id={recordId}
    ></lightning-record-form>
</lightning-modal-body>
<lightning-modal-footer>
    <lightning-button label="Open Record page" onclick={handleClick}></lightning-button>
</lightning-modal-footer>
bearModal.js
    import { LightningElement,api } from 'lwc';
import LightningModal from 'lightning/modal';

export default class BearModal extends LightningModal{
    @api content;
    recordId;
    connectedCallback(){
        this.recordId=this.content;
    } 
    handleClick(){
        console.log("clicked"+" content:"+this.content+" recordid: "+this.recordId);
    }

}

I places the recordId in the '<P>' just to make sure that everything is loading well and good. So whenever I click a button on the page, the modal window pops up and displays the record. It worked for a while then it stopped working all together, the modal just appears with the record id from the <p> tag but the record form is not displayed. Please help me out, thanks!

1 Answer 1

0

The "Compact" for layout-type is case sensitive

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .