0

Am calling Target component (lightning page) from a source component

var urlEvent = $A.get("e.force:navigateToURL");
    urlEvent.setParams({
        "url": "/lightning/n/Pie_Chart"
    });

    urlEvent.fire();

I want to pass attributes used to Target Component which is present in that lightning Page.

The attribute values should be passed from lightning:input present in Source Component.

Note: I can't go with e.force:navigateToComponent because I need to call Lightning page and I do have design attributes so I can put my target component in Lightning page only.

0

You can pass parameters appended in URL itself. For this, you need to have isUrlAddressable implemented.

Documentation link - https://developer.salesforce.com/docs/component-library/bundle/lightning:isUrlAddressable/documentation

Copying example from Documentation -

You can pass param in URL like this -

/lightning/cmp/c__helloTarget?c__title=Director

In following way you can get parameters which is present in URL -

var myPageRef = cmp.get("v.pageReference");
var title = myPageRef.state.c__title; //this is present in URL
cmp.set("v.title", title);
| improve this answer | |
  • But I don't want parameters to be in URL. Can we try another way ? – Prathyusha Aug 4 at 9:41
  • I don't see much option in this, for more security pass the URL params encrypted. So with this data won't be exposed to other users. – Ysr Shk Aug 4 at 10:48
  • Also one more thing we can use. - Browsers storage API. you can store some of the params there and use in the code directly. – Ysr Shk Aug 4 at 10:49

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.