You need to sign in to do that
Don't have an account?
Ian Quah
Transitioning (passing variables) between two separate Lightning Resources
Say I have two separate lightning resources: A, and B.
How would I pass variables between the two? If, for example, in page A I get all the individuals for whom I can generate profiles (example: word docs) how do I then pass that list of people eligible for profile generation to B, where I can then iterate through the values to generate them?
Or is there an elegant solution to the problem that I didn't see?
How would I pass variables between the two? If, for example, in page A I get all the individuals for whom I can generate profiles (example: word docs) how do I then pass that list of people eligible for profile generation to B, where I can then iterate through the values to generate them?
Or is there an elegant solution to the problem that I didn't see?
So, How are A and B connected to each other.
Is B nested within the A component? (Parent-Child Components) Here B is a Child component, You can either send Values from A to B using Events (Component Events) or by Using Attributes (easiest method) or using methods.
Read the detailed Blog post here (https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html). You can find lot of examples in this post.
Are A and B are saperate components? (Sibling Components)
Then you need to use Application events.
So, to know how to use and impliment the methods i mentioned above. Refer this blog post (https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html)( It has code samples too).
To know more about Events..Refer the official documentation here (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_intro.htm).
Let me know if you need anything else. Good Luck.
Best,
Nithesh
All Answers
If yes, you can create an event and pass the values/list of individuals from A and then can handle the event in component B.
Or if B is child component of A then you can pass the values as the attributes to component B.
Let me know if you need any further help.
Regards,
Ashish Kr.
So, How are A and B connected to each other.
Is B nested within the A component? (Parent-Child Components) Here B is a Child component, You can either send Values from A to B using Events (Component Events) or by Using Attributes (easiest method) or using methods.
Read the detailed Blog post here (https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html). You can find lot of examples in this post.
Are A and B are saperate components? (Sibling Components)
Then you need to use Application events.
So, to know how to use and impliment the methods i mentioned above. Refer this blog post (https://developer.salesforce.com/blogs/developer-relations/2017/04/lightning-inter-component-communication-patterns.html)( It has code samples too).
To know more about Events..Refer the official documentation here (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_intro.htm).
Let me know if you need anything else. Good Luck.
Best,
Nithesh
(thanks for rewarding me with Best Answer!!)
Best,
Nithesh
I may have to try application events...