2

I am having a simple redirection from lwc to aura component. In LWC Js:

    this[NavigationMixin.Navigate]({
        type: "standard__component",
        attributes: {
            componentName: "c__OrderLinesUiFullPage"
        },
        state: {
            c__orderId: "test"
        }
    });

And the aura component:

<aura:component implements="flexipage:availableForAllPageTypes,lightning:isUrlAddressable" access="global" >
    <aura:attribute type="String" name="orderId"/>
    Hello {!v.orderId}
</aura:component>

The redirection works fine. But the attribute - the orderId - is not passed successfully. I have followed the instructions provided by document to add c__ before the attribute name but it still doesn't work. Any thoughts?

3

You need to add this in your aura component:-

({
    init: function(cmp, evt, helper) {
        var myPageRef = cmp.get("v.pageReference");
        var firstname = myPageRef.state.c__orderId;
        cmp.set("v.orderId", firstname);
    }
})

The attribute value is getting passed, but it needs to be set. Use init handler in your aura component markup.

<aura:handler name="init" value="{!this}" action="{!c.init}"/>    
<aura:attribute type="String" name="orderId"/>
        Hello {!v.orderId}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.