Skip to main content
Mahamed Raheem (Virtusa) 님이 #Lightning Experience에 질문했습니다
Hi,

I have to navigate LWC to Aura component, so in this scenario how to pass recordId LWC to aura component

can any one help me on this.
답변 6개
  1. 2019년 7월 28일 오전 9:45
    Hi Mahamed,

    Please try this code:

    LWC js file:

    navigateToComponent() {

        this[NavigationMixin.Navigate]({

            "type": "standard__component",

            "attributes": {

                "componentName": "c__navigateAura", 

            },

            state: {

                c__recordId: this.recordId

            }

        });

    }

    Aura Component:

    navigateAura.cmp

    <aura:component implements="lightning:isUrlAddressable,force:hasRecordId" access="global" >

        <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

        <aura:attribute name="recordId" type="String"/>

        <aura:attribute name="test" type="string"/>

        {!v.recordId} --->this record Id comping Null.

    </aura:component>

    navigateAura.js:

    ({

        doInit : function(component, event, helper) {

            var myPageRef = component.get("v.pageReference");

            var recordId = myPageRef.state.c__recordId;

            component.set("v.recordId", recordId);

        }

    })

    I hope it helps you.

    Please let me know if you have any other query and If this solution is helpful then please mark it as Best Answer.

    Thanks,

    Ankit Rathor
0/9000