You need to sign in to do that
Don't have an account?
SFDC Forum 9
how to use attribute from one compenent to another
I have list type attribute in lightning component1.On compoent load, list will get some values from apex method.
Now I have another component.I will click on menu item in the menubar, code as below.
<lightning:buttonMenu alternativeText="Toggle menu" label="Partcipant Info" onselect="{!c.doRedirect}" >
<lightning:menuItem label="Home Page" value="menuitem1" iconName="utility:table"/>
<lightning:menuItem label="Account Balance" value="menuitem2" iconName="utility:table" />
</lightning:buttonMenu>
So in doRedirect.js, i need to get compoent1 list type attribute.
Note:Both compoents are on same page.
Now I have another component.I will click on menu item in the menubar, code as below.
<lightning:buttonMenu alternativeText="Toggle menu" label="Partcipant Info" onselect="{!c.doRedirect}" >
<lightning:menuItem label="Home Page" value="menuitem1" iconName="utility:table"/>
<lightning:menuItem label="Account Balance" value="menuitem2" iconName="utility:table" />
</lightning:buttonMenu>
So in doRedirect.js, i need to get compoent1 list type attribute.
Note:Both compoents are on same page.
Please follow the steps in the developer guide.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_application.htm
Step 1: Create an event.The ceEvent.evt component event has one attribute. We’ll use this attribute to pass some data in the event when it’s fired.
Step 2: Create a Notifier Component
The c:ceNotifier component uses aura:registerEvent to declare that it may fire the component event.
The button in the component contains an onclick browser event that is wired to the fireComponentEvent action in the client-side controller. The action is invoked when you click the button. Create Handler component
please understand the complete dataflow between components here
https://medium.com/@das.ranbir/lightning-aura-component-279bcf1785cd